Jekyll customizations for sakhnik.com
Two features has been added to the site recently: language change flag in the header and pagination of posts. To achieve this, I had to learn some basics of Jekyll, liquid and Ruby. Let’s summarize how it was done.
Pagination required a custom generator plugin. Starting from an existing one, it was trivial to hack off excessive parts, adopt to my requirements. The resulting plugin is available in github. The pagination links are generated with pagination.html.
With lots of pages, previous way of language switching became broken, because
there would be many pages with given ref
now. So we select only the first
link now for the opposite language. The result is pleasant.
Given the possibility, I refactored few bits of code to avoid duplication
of code, for instance, in page layouts. If there were different just in localized
strings, I just moved the definitions to
_config.yml
. Perhaps, it’d be better to keep them in the local
front matter.