Blog now processed by Jekyll
So a while ago I created my own parser to make a blog in Dropbox. The basic setup was to store the markdown-files in Dropbox and have a hosted PHP-file get these files and parse them ‘on the fly’.
Apparently there are more ways to do this. Jekyll also parses static markdown files into a working blog site. There’s even the same color-theme (solarized) as I was using before.
So, without further ado, it is now possible to browse exactly the same content as you had before! :D
Why #
Of course there are some advantages to the new setup:
- Easier theming
- Better tags (or tags :)). The old solution was to just add a category to the title, with Jekyll I can do fancier things as having an archive based on categories.
- Proper RSS
- Faster: old PHP solution was quite slow sometimes, it had to load several external files from Dropbox
- Reliable: obviously Dropbox didn’t make the Public folder to host websites from and letting PHP fetch those files. Sometimes it broke without me having a clue why.
- Security: I had implemented some basic security measures, but I was never really happy with the old code. It retrieved external files and parsed them, that does not seem safe. Jekyll instead generates static html+css.
- Wanting to try something new. Now I’ve learned the (very) basics of Jekyll and Liquid templating engines.
- Future possibilities: such as adding excerpts to the blog posts in the Archive.
Changes #
Content transfer was not a one-click solution. I had to go through all my blogposts and change the following:
Codeblocks
I’ve had to change all codeblocks from ``` to ~~~. This one sounds simple, but was the most work. I wanted Github style codeblocks using the three backticks, but none of the Jekyll Markdown parsers properly support it. So instead I had to revert to three tildes. 2017: this is no longer true, backticks are now also supported
Titles
My old blog had a separate file where the titles+filenames of all blogs were for creating an ‘index’. The titles inside the article where written with the default Markdown method (adding a list of ====== under the title). Jekyll creates the list of blogposts automatically from the blog-files, but uses a customised method of defining the title (and other meta-data):
---
title: Blog now processed by Jekyll
category: stronk
layout: post
---
Add dates
One of the advantages of my old blog was that I didn’t have to have dates attached to my articles. So that means my one reader wouldn’t see the extremely low update frequency. Sadly, Jekyll is based around these dates and I had to retroactively look up all dates for the articles and add them.
Publishing method
With the old method, I wrote an article in Dropbox and published it by adding it to the list of ‘published articles’. The parsing etcetera happened automatically. With Jekyll, I have to compile and upload the site actively.
Base url
Basically this is fucked up. Jekyll doesn’t properly do the base url, so you got to work around it. Add a ‘site.url’ and ‘site.baseurl’ in your config file, and have these added to the ‘base’ in your html-head. And then you have to make sure all links made by Jekyll have no slash in front with:
| remove_first:'/'}}
Changing links
So Jekyll doesn’t do auto-link creation for URLs in Markdown. Pity, parsedown
did do it… I had to update all blog-items and change the links
(www.example.com
to <www.example.com>
).