> ## Content Index
> Fetch the complete content index at: https://discoverghost.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Quick Tip: The Tag loop in a Ghost theme
- URL: https://discoverghost.com/the-tag-loop-in-a-ghost-theme/
- Published: 2014-02-25T10:27:04.000Z
- Updated: 2014-02-25T10:36:27.000Z
- Author: Harish Chouhan
- Tags: Themes, #Import 2026-07-20 02:58, #Import 2026-10-22 16:21

Official theme documentation is still evolving however the forums continue to be the best place to learn from fellow Ghost developers.

Recently while trying to wrap the tags, the code given on the official documentation did not work as expected. But thanks to the help from forum, you would find below an example code to detect if tags exists for a post and if they do, then it displays them in a nice unordered list.

[Conversation on Ghost.org Forum](https://ghost.org/forum/bugs-suggestions/5435-tag-loop-not-working-as-intended/?ref=discoverghost.com)

```
{{#if tags}}
<ul class="tags">
    {{#foreach tags}}
    <li class="tag">{{name}}</li>
    {{/foreach}}
</ul>
{{/if}}

```

Have any other useful code to share? Do email us at [me@harishchouhan.com](mailto:me@harishchouhan.com) with your details.