Automating Blogpost Generation with Python
As can be seen from this website, I run a blog. I've always wanted to host a blog of some sorts but I never was able to find the right tools to do so. In order to combat this, I made a simple prototype blog website that can be hosted on a static webhost, such as Neocities.
How it Works
This website is generated via the use of the program 'md2html', supplied by the project 'md4c' found here . A Python script then takes the generated HTML source and inserts it into a pre-made blogpost template file, before writing the blogpost to a directory. The script currently assumes that the generated HTML has only one h1 tag and that it contains the title for the blogpost.
The script is also complemented by another Python script, which is used for updating the sidebar with new files. This script iterates over all blogposts in a directory and appends them to a sidebar template file, before writing this to 'sidebar.html'. Each page then contains an iframe to this file for displaying.
Future Work
These scripts are very janky at the moment, having no error handling, and assuming a large amount about how the generated HTML is laid out. Obviously these need to be handled before releasing the source code. Along with this, integration with git to allow for automatic pushing to Neocities (via their command line interface) when committing to the main branch would be a great idea.