1 # lb -- Luke's Blog Script 2 3 Blogs and RSS feeds in less than 100 lines of shell script, actually, right now, less than 80. `lb` stands for whatever. Maybe "Luke's blog", maybe "lightweight blog", maybe "less bloat", doesn't matter that much. 4 5 [Video Showcase](https://www.youtube.com/watch?v=S1WQlr42xDM) 6 7 ## Features 8 9 `lb` is an extremely small shell script that lets you write blog posts and will format them in all the ways you could ever want. Here's what it will produce: 10 11 - A Rolling Blog Page. See [my own Rolling Page](https://lukesmith.xyz/blog.html) as an example. 12 - A list of all blog entries with dates: [Blog List File](https://lukesmith.xyz/blogindex.html). 13 - All your blog posts appear as standalone entries/pages, for example [like this one](https://lukesmith.xyz/blog/the-real-bronze-age-mindset.html). 14 - These standalone files exist in a `blog/` directory, which you can allow to be browsed manually via your Apache web server as I have [here](http://lukesmith.xyz/blog). 15 - Blog posts are added, in full form, to an RSS feed of your chosing as well, see [my RSS feed](https://lukesmith.xyz/rss.xml). 16 - Posts in the rolling blog have divs that can easily be modified via a CSS stylesheet, and in general everything is easily editable. 17 - One command to delete published entries from the RSS feed, rolling blog and standalone entries simultaneously. 18 - Published blog entries can now be revised, updating the standalone blog pages, the RSS feed and everything else. 19 20 ## Usage 21 22 `lb` commands are all one letter cause I'm lazy. They all stand for something though. 23 24 ```sh 25 ./lb n(ew) # Make a new blog post draft. 26 ./lb e(edit) # Edit a draft of an entry. 27 ./lb t(rash) # Delete a draft of an entry. 28 ./lb p(ublish) # Finalize/publish a blog post draft. 29 ./lb d(elete) # Delete a published blog post. 30 ./lb r(evise) # Revise an already published entry (you can republish it with `lb p` when done) 31 ``` 32 33 ## Installation 34 35 + bash and GNU sed is required. >inb4 bloat 36 + Be sure that you own or have writing privileges in the given directory, so the script can create the required directory structure. 37 + Download the `lb` script and put it in your website's main directory. The expectation is that your rolling blog file and RSS feed will be there as well. 38 + Open the script and change the first few variables to match the names of the files you use in your website. 39 + Add markers for where the new blog posts are added. **Don't skip this step.** See below. 40 41 ### Markers 42 43 For the system to work, add the following comment line to a (1) Rolling Blog File (as above), a (2) Blog List File and (3) RSS feed. 44 45 ``` 46 <!-- LB --> 47 ``` 48 49 You can format these files/pages how ever you want, just be sure to edit the `lb` file and change the variables at the top to match the file names of those you chose. 50 51 When you `finalize` a blog post, it will be added directly below that line in the proper format (either HTML or the proper RSS/XML format), give you the rolling blog and RSS feed for free. 52 53 ## Info 54 55 - The blog entries are stored in `blog/` in your websites root directory. Drafts are in `blog/.drafts`. 56 - `blog/.htaccess` acts as a "database" file. `lb` stores filenames with their corresponding proper names and publishing dates there. 57 - The other files in this repo just illustrate how you can use `lb`. Only the `lb` script itself is necessary. 58 - Your `$EDITOR` variable should be set to your preferred text editor, vim will be assumed if you don't have one set.