Today I Learned #01Permalink
Starting this series, I’ll share a simple way to filter posts in Jekyll
, which is the tool that I use to build this site.
Today I learned - How to filter in JekyllPermalink
Jekyll uses liquid
as a template language, so we can easily add some logic to our pages. This is an interesting way to share something on a specific subject, like this Today I Learned series.
The below example filter post by this tag today-i-learned
and lists all the posts.
{% for post in site.posts %} | |
{% if post.tags contains 'today-i-learned' %} | |
<li> | |
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> | |
</li> | |
{% endif %} | |
{% endfor %} |