An How to Support Tags in a Jekyll Blog

An easy way to support tags in a jekyll blog

This gist will generate a page per category for you: https://gist.github.com/524748

It uses a Jekyll Generator plugin, plus a Page subclass.

How can I add proper tag support for jekyll blog hosted on GitHub?

Current Jekyll (3.1.x) cannot generate tag page automatically. You need to use a custom plugin. But you don't want to.

Why ? It's not so difficult to change deployment process on github pages.

You can store you code in master and you generated page in gh-pages. This answer will give your more information on how to do it.

Jekyll - If there is more then 1 post.tag for a blog post then display a message otherwise display the tag name

Edited answer :

I saw that tag.url returns nothing and it's normal.
But, if you are using tag pages (by hand or with jekyll-paginate-v2), you already know their urls. You can craft something like I'm doing in this edit for href supposing that your tag pages urls are of the form /site.basurl/tag/tagname/.

Feel free to adapt the code.

You can try this :

{% if post.tags.size > 0 %}
{% if post.tags.size > 1 %}
<a class="toggle-tag-list">View tags</a>
<ul class="tag-list hidden">
{% for tag in post.tags %}
<li><a href="{{ site.baseurl }}/tag/{{ tag | slugify: "ascii" }}/">{{ tag }}</a></li>
{% endfor %}
</ul>
{% else %}
<a href="{{ site.baseurl }}/tag/{{ post.tags.first | slugify: "ascii" }}/">{{ post.tags.first }}</a>
{% endif %}
{% endif %}


Related Topics



Leave a reply



Submit