/ Static Website Generation

This website started out as a Python experiment that quickly grew into a little framework for static website generation. It is similar to Jekyll or Hugo, except that I've only implemented a very small subset of features that fits my needs.

My setup consists of 3 things:

Most of the pages are written in simple Markdown language and don't require any scripting. Markdown is easy to read and write, which means that you can focus on creating and structuring your content. The converter takes care of all the HTML tags. And you can still write HTML if necessary.

The Python script takes Markdown files and turns them into HTML documents with the help of the Markdown package. The Markdown files contain custom metadata which can be used to add some flavour and additional information to the individual pages, i.e. page title, author, copyright information, which CSS file to link, etc.

When inserting the generated HTML into the final page, the Python script checks for specific tags that add more complex elements to the page, or that contain executable Python code.

For instance, I've defined an HTML tag that allows me to add syntax highlighting to source code, using the Pygments package. This can be seen in my C++ Programming article.

I can include other Markdown files into the current file and compose my content that way. This allows for the generation of more deliberate documents with multiple chapters and sections.

I can read data from JSON files and use it to generate HTML content. The Freeware Recommendations page is generated this way. Since the data is stored independent of formatting or layout, it is very easy to either add content by editing the JSON file, or change the formatting by editing the script. You can also programmatically compose the data on the page, by filtering or sorting it, before the HTML is generated. The JSON file essentially becomes a little database.

I have deliberately chosen to keep my site as simple as possible, but you can use W3.CSS to create a more modern and consistent design throughout your pages. In combination with the scripting, you can easier add CSS id or class attributes to your page and HTML elements.

In summary, this is the easiest and most flexible way of creating static websites and HTML documents that I know of. Yes. there is some light Python scripting involved, but this will empower you to create or generate any type of HTML content.

Further Reading

If you want to know more about creating modern static websites, check out the book:
"Working with Static Sites" by Brian Rinaldi & Raymond Camden

If you are looking for reasons why to create your own static website, instead of using a website service: