How lukesmithxyz/lb works
Main Components
• Shell Scripts:
• lb: Handles blogging features (new draft creation, editing, publishing, revising, and deletion). It works with:
– The rolling blog page (e.g., 2019.html or blogindex.html).
– The RSS feed file (rss.xml).
– Standalone blog post pages stored inside the blog/ directory.
– A pseudo-database file using blog/.htaccess (which maps filenames, titles, and publishing dates).
• sup: Acts as a site updater that extracts and inserts updates from standard pages (e.g., favorite-programs.html) into the RSS feed.
• Static Site Files:
• Rolling Blog Page (blogindex.html, 2019.html): Where new posts are aggregated.
• RSS Feed (rss.xml): Updated by both lb and sup.
• Blog Posts Storage (blog/ directory): Contains individual blog posts and the .htaccess “database”.
• Style and other HTML files (style.css, blog/this-is-what-a-post-looks-like.html, etc.): These form the website’s presentation.
• Configuration/Markers:
• The “<!-- LB -->” marker in HTML and RSS files to indicate insertion points for new content.
• Environment variables like $EDITOR and custom variables within the scripts to designate file names and paths.
Relationships & Data Flow
• Users interact with the scripts via the command line (using a text editor for drafts and revisions).
• When lb is run:
• It creates or updates blog post drafts.
• Upon publishing, it updates multiple files: it appends the formatted blog post to the standalone page (placed in blog/), inserts the new formatted entry below the LB marker in the rolling blog file and RSS feed, and updates the “database” in blog/.htaccess.
• When sup is run:
• It extracts specific content (only the <body> minus <nav> and <footer> sections) from a given HTML page.
• It then updates the RSS feed with this new content.
Architectural Patterns & Relevant Technologies
• The design follows a simple script-based architecture that manipulates static files using shell scripting and sed.
• Separation of Concerns is evident: lb is solely for blog content management while sup is dedicated to general site updates.
• The project has a minimalistic, single-server, file-driven static site architecture with no separate backend or database server—using the file system (and a hidden “database” file) to store state.
• Dependencies include bash and GNU sed.
• The use of markers in HTML ensures that the scripts know exactly where to insert new content which is a clever separation of content and template.