Adding author attribution to the blog
Having a way of adding a reference to the blog post author is nice, and as it turns out this is supported by default in Jekyll by adding a author: Author Name
to the Front Matter part of the post. But to make it a bit more interesting you can easily add a few tweaks.
With inspiration from this post I added a list of authors as laid out in the post, and then tweaked the post.html
file in the _layouts
directory to look like this:
---
layout: default
---
{% assign author = site.data.authors[page.author] %}
<div class="post">
<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
<p class="post-meta">{{ page.date | date: "%b %-d, %Y" }}{% if author %} • <a href="{{ author.web }}" target="_blank">{{ author.name }}</a>{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
</header>
<article class="post-content">
{{ content }}
</article>
</div>
And that was it. After rebuilding the site each post now shows the authors with a link to the author’s web page!
The templating enigne used is Liquid, learn more (including how to temporarily disable template processing for the code above to be outputted correctly) on their wiki