Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

tag(s).hbs does not build post list automatically

  • #8202
    Avatar photo[anonymous]

    Hi there,

    I built a menu in Publii with an entry labeled foo and type Tags list link.

    I tried the following code on tag.hbs to show the corresponding post. Unfortunately, it does not work. So, what am I doing wrong ?

    And secondly, how do I make this dynamically to use one *.hbs for all tags…

    {{#each @website.contentStructure.tags}}
      {{#checkIf this.name '==' 'foo'}}
        {{#if this.postsNumber}}
          {{#each this.posts}}
            {{title}}
          {{/each}}
        {{/if}}
      {{/checkIf}}
    {{/each}}

    Thanks, Michael

    #8315
    Avatar photo[anonymous]

    Hi,

    Why are you using such construction if tag.hbs can display all related posts: https://getpublii.com/dev/tag-page-tags/ ? Please look how tag.hbs is constructed in our free themes.

    Your code won’t work, because in the contentStructure tag items contain posts field, but it contains only IDs of related posts, so you have no direct access to the post titles there.