Sign in

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

  • This topic has 1 reply, 2 voices, and was last updated 1 year, 2 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8202
    Avatar photomuch.fun

    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 photoTomasz Dziuda

    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.

     

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘tag(s).hbs does not build post list automatically’ is closed to new replies.