Site Improvements
Posted Saturday 04 January 2020 at 21:39
Estimated reading time: 3 mins
Over the last couple of days, I've been working on a bunch of improvements for the site. A good number of them are under the hood, and should have no impact on what you see (unless I've introduced some bugs, of course!), but there are a couple of new things of note I wanted to talk about.
Markdown
The most interesting improvement is in how my posts are created. Rather than hand-writing the posts in HTML, I've switched to rendering the posts from markdown. Everything works in exactly the same way using the same templates, but the template contents is filled by a markdown renderer instead of being done manually. I get to use the same formatting as I normally would; bold, italic, inline code
, and
code blocks
but in a way that's much, much more convenient to do. More interestingly, I can also add syntax highlighting to any code snippets I add, for example:
# this is Python code
print("Hello, world!")
This should remove some of the friction between writing a post and publishing it, which should (hopefully!) lead to more frequent posts, or at the very least make the posts that I do create richer for you, the reader.
Refactoring
The entire codebase has been refactored and grouped into sub-packages, which makes the site much more maintainable and makes some of the code for existing features simpler. It adds a little bit of boilerplate, sure, but it makes it easier for me to diagnose problems and allows me to focus on what features to add, rather than how and where to add them to the code.
Meta Tags, etc.
As a result of having better clarity in my code, I've been able to make some real improvements to the design and professionalism of my site. Finally, more than a year after creating the site, I've added a favicon! I'm in with the professional sites now, clearly.
You'll also notice (if you're reading on the site, rather than the RSS feed) that blog posts now have an "estimated reading time", which uses a slightly modified version of this code from Medium.com to give you an idea of the length of a post.
A really interesting and useful new feature is the addition of <article>
tags on blog posts and Open Graph protocal <meta>
tags across the whole site. This means that blog posts can be read in reader view on iOS devices if you'd like the formatting to be reduced and the post perfectly scaled for your device, and that various other services (e.g. Telegram) can provide a little more context about the posts when they're linked there.
These are all steps towards making the site more professional, and more accessible to anyone who wants to browse my site. Even though this site is, at the end of the day, just a hobby, it's all a learning curve, and hopefully the improvements are worthwhile.