jekylljekyll-bootstrap

Jekyll Tag List on a Page


I'm attempting to display a list of tags using Jekyll. Here is what my HTML on the page looks like:

<ul>
  {% for tags in page.tags %}
    <li>{{ tags }}</li>
  {% endfor %}
</ul>

And this is the information in my front matter:

---
layout: template
title: Title
tags: all portfolio something
---

I am getting an output, but it is just creating a list like this:

instead of what I am trying to acheive, which is this:

Any troubleshooting on this would be much appreciated, thank you!


Solution

  • I tried on a new Jekyll website (with Jekyll 2.0.3), and the following front matter worked well (make sure to use tags, not tag:

    ---
    layout: template
    title: Title
    tags: all portfolio something
    ---
    

    You can also use a list:

    ---
    layout: template
    title: Title
    tags:
    - all
    - portfolio
    - something
    ---
    

    Then, use in your post or in your layout:

    <ul>
      {% for tags in page.tags %}
        <li>{{ tags }}</li>
      {% endfor %}
    </ul>
    

    If you still have a problem, consider upgrading Jekyll, providing a MWE or the output HTML/CSS.