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
Git, Heroku: Pre-Receive Hook Declined
How to Dynamically Create a Local Variable
How to Change Default Timezone For Active Record in Rails
Is 'Eval' Supposed to Be Nasty
What Does the "===" Operator Do in Ruby
Is There a "Do ... While" Loop in Ruby
Ruby Multiline Block Without Do End
Pass Parameter by Reference' in Ruby
String Concatenation Vs. Interpolation in Ruby
How Does Object_Id Assignment Work
Difference Between Datetime and Time in Ruby
What's the Difference Between a String and a Symbol in Ruby
Need a Simple Explanation of the Inject Method
How to Solve "/Usr/Bin/Env: Ruby_Executable_Hooks: No Such File or Directory"
How to Avoid "Cannot Load Such File - Utils/Popen" from Homebrew on Osx