metinsaylan // rogue developer

Tag index generator for Jekyll (Python)

I recently switched to Jekyll blogging system on Github Pages. It has many great features and serves your site content directly from Github servers. However, Jekyll is a static site generator and doesn’t automatically create Archive indexes. So I wrote a python script to create automatic tag indexes.


How does it work

Script scans all your markdown files and extracts a list of tags. Then using that tag list, it creates tag index pages if they don’t already exist. Whenever a new tag is added, script needs to be run again.


How to make it work

  • Install Github client and clone your site to your computer.
  • Install Python 3.x.
  • Install python-frontmatter by Chris Amico.
  • Put the following script to your site root directory with name generate_tag_pages.py
  • Fix tag_page_dir option in the script (line 3).
  • Put following code in _includes directory as loop.html:
  • Run the script.
  • Commit & push.

Conclusion

I know this is a long tutorial,
but it certainly saves you a lot of time :)

Enjoy!

Search Tag index generator for Jekyll (Python) on Google