Away with the dirtier hack (and hello to something good!)


=> [1] 004 is mentioned.
=> [2] This is a sequel to 005.

I'd like to begin by saying that 004 [1] and 005 [2] are now deprecated. They no longer represent a system that is still active.

Similarly, my tildegit dynamic page repo is not the state of what is used.¹ I might get around to updating it at some point. For now, however, it is private.

But this is not what I want to talk about. I want to talk about the blogging platform I've built.

It's based on two bash scripts, =ndraft.sh= and =publi.sh=.

=ndraft.sh= creates a new draft and fills it with a skeleton of a blog post. As of currently, it relies on having a footer in the file itself, and can't use external ones, but I might do that if it proves to be more useful for me.
It is also responsible for generating a slug.²
The blog posts themselves are static, the footers are baked into the file, and changing them requires a script that recognizes an old footer and replaces them with a new one.³

UPDATE AS OF 13. OCTOBER 2021 (yes, this post has been in writing for so long):

=ndraft.sh= creates a skeleton that only contains the title and the content.

The footer is added later on by =fini.sh=.

This removes the need for a script that replaces footers.

=publi.sh= moves the blog posts from my drafting directory to those of the full posts, and makes a corresponding entry in the SQLite database that powers the blog.

The database has one table, =Entries=, which holds the =Date=, =Name=², and the =Title= of the blog post.

When a reader goes to my index page or my blog overview, the database is read and either a part of (the last 5 posts) or the whole history is pulled from the database.

This works quickly and reliably and removes the need for the dirty hacks I showcased in 005. [2]

Having the title of the post in the database was an afterthought -- something I thought of only when all the posts were already migrated. It was a bit stressful to update the database to support it, but now I am rewarded with a cleaner interface.

tags:
gemini