Show Div for a specific tag only

Sorry guys, for the newbie question.

I need to show a div block only on the specific’s tag’s page. I work with tag.hbs and need something like this → if tag name, show div, else not.

{{#if tag:tagname}} 
<div>Show this div</div> 
{{/if}}

And it didn’t works, obviously. Could you please help me with the right one solution :pray:

Inside {{#foreach posts}} block, you can test if a post has a specific tag with:

{{#has tag="tagname"}}..{{/has}}


If you want a custom template for a particular tag archive with an extra div, then you can duplicate tag.hbs and name it tag-[slug].hbs to use that template instead

2 Likes

Thanks for an extremely fast reply, John!

I probably wrote incorrectly. I work with main tag page template (tag.hbs), and need to add additional div to this template. But I need to show this block only on specific tag’s page. In other words, I need to determine which tag page I am currently on, and if the desired tag is used, then show the div.

The docs John linked you to contain the answer - use {{#has slug=""}}

2 Likes

Huge thanks! Figured it out! :+1: