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.

Tags for “Tag_prefix” and “Author_prefix”

  • #7697
    Avatar photo[anonymous]

    Hi,

    I’m trying to include the “tag-prefix” and “author-prefix” in my breadcrumbs menu but couldn’t find the appropriate tag to use.

    For example, URL for “widget1” is “domain/products/widget1”.

    On the tag.hbs page,  {{name}} returns “widget1” but how does one get “products”?

    Thanks.

    #7701
    Avatar photoBob

    widget1 is a tag or a post name?

    #7754
    Avatar photo[anonymous]
    [anonymous] wrote:

    widget1 is a tag or a post name?

    Hi Bob,

    In my example, widget1 is a tag.

    So, on the tag page for widget1, the desired breadcrumbs would be

    Home > Products > Widget1

    And if Post1 had widget1 as its main tag, the breadcrumbs would be

    Home > Products > Widget1 > Post1_title

    Thanks.

    #7756
    Avatar photoBob
    #7768
    Avatar photo[anonymous]
    [anonymous] wrote:

    Take a look at this topic: https://forum.getpublii.com/topic/breadcrumb-and-multilanguage/

    Yes, I was following the method in that post and that worked well for the post pages.
    I also wanted to implement similar breadcrumbs for the tag pages, for example, https://example.com/TAG_PREFIX/tag-slug1, I would have liked the breadcrumbs to look like:
    Home > TAG_PREFIX > tag_name1

    Then on the tags page,
    Home > TAG_PREFIX

    However, there’s no tag like {{tag_prefix}} where the TAG_PREFIX can be retrieved.

    Likewise, for author pages, for example,  https://example.com/AUTHOR_PREFIX/author-slug
    there’s no tag like {{author_prefix}} where the AUTHOR_PREFIX can be retrieved.

    #7834
    Avatar photoBob

    Publii does not generate a tag prefix, so your breadcrumb can look like: https://example.com/tag_name1

    However,  including the current page in the breadcrumbs is not required by Google:

    If the breadcrumb is the last item in the breadcrumb trail, item is not required. If item isn’t included for the last item, Google uses the URL of the containing page.

    Look at the breadcrumb used on the google page: https://developers.google.com/search/docs/advanced/structured-data/breadcrumb

    google-breadcrump

    So personally, I would only use one element on tags page – a link to the home page and on tag pages, I would use an additional element with a link to tags pages e.g.  Home – Tags

    live example: https://demo.getpublii.eu/themes/q-answer/1/tags/javascript/

    #7837
    Avatar photo[anonymous]
    [anonymous] wrote:

    So personally, I would only use one element on tags page – a link to the home page and on tag pages, I would use an additional element with a link to tags pages e.g. Home – Tags

    Hi Bob,

    Thanks for your feedback.

    I have “products” for my “Tag prefix” in the URLs setting instead of the default “tags”.

    On the tag pages, the URLs I’m getting are like:

    • example.com/products/plastic-cards/
    • example.com/products/accessories/
    • example.com/products/lanyards/

    Using your same example, I would like to show “Home – Products” instead of “Home – Tags”. 

    I was hoping not to hardcode “Products” in my breadcrumb trail for my tag.hbs file but use a {{tagsPrefix}} 

    How can I make a helper to return {{tagsPrefix}} (urlsConfig.tagsPrefix found in Publii source code file, \app\back-end\modules\render-html\helpers\url.js)?

    Thanks.

    #7838
    Avatar photoBob

    Tags page URL:  {{@website.tagsUrl}}

    Tags page title:  https://getpublii.com/dev/tags-page-tags/

    #7840
    Avatar photo[anonymous]

    So, assuming you customized the tags prefix names in your lang.json file (which is what I would recommend)…

    Try this for the products breadcrumb link:

    {{ translate 'tags.tagsPageTitle' }}
    #7841
    Avatar photo[anonymous]

    Thanks Bob and Candide!

    Your suggestions worked great.  Shows I still have a lot to learn about Publii.

    Cheers!

    #7843
    Avatar photo[anonymous]
    [anonymous] wrote:

    Thanks Bob and Candide!

    Your suggestions worked great. Shows I still have a lot to learn about Publii.

    Cheers!

    I’m so happy to hear that!! 🥳

    I just found out about the lang.json stuff this past week while editing my portfolio site and changing the name of my tags as well. There’s always something new to learn about Publii. 😊