Automatically Add GitHub Links to Jekyll Posts
March 14, 2014When I switched to Jekyll, one of the first features I embraced was the Liquid syntax. Markdown is a joy to write, and having a template abstraction layer like Liquid makes templating equally easy and understandable. Using yaml abstracts that templating logic even further. Being an open source contributor, I wanted a maintainable way write about and link to projects I was working on.
To start, I added some site-wide settings. Appended to _.config.yml
:
And then in each post that was about a GitHub project, I added the github
setting pointing to the repository name.
And then finally, I hooked the two up in the my post layout:
I also add links to download, fork, and file an issue on GitHub. Writing about and pointing readers to projects I’m working on is now maintainable and conveninent.