I was creating a ghost blog and i created a custom component to display all the tags in the blog.
I used the below code to do so,
{{#get "tags" limit="all"}}
<ul class="tags">
{{#foreach tags}}
<li>
<a href="{{url}}">{{name}}</a>
</li>
{{/foreach}}
</ul>
{{/get}}
I made the component to act as a filter. But I am facing some issues,
can someone help me with what I am doing wrong.?
Thanks in advance.
I believe tags with no posts technically don't exist so they don't they don't create empty page routes, as all tags have their own tag page (/tag/example-tag/
). As for knowing the active class I assume you're wanting to apply an active class to the tag link, which can be done with link_class
:
<a class="tag {{link_class for=url class='tag-current'}}" href="{{url}}">{{name}}</a>