Tags for “Tag_prefix” and “Author_prefix”
-
July 7, 2022 at 11:20 am #7697[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.
July 7, 2022 at 2:39 pm #7701Bobwidget1 is a tag or a post name?
July 8, 2022 at 8:12 am #7754[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.
July 8, 2022 at 10:57 am #7756BobTake a look at this topic: https://forum.getpublii.com/topic/breadcrumb-and-multilanguage/
July 9, 2022 at 7:43 am #7768[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_name1Then on the tags page,
Home > TAG_PREFIXHowever, 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.July 15, 2022 at 6:27 am #7834BobPublii 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
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/
July 15, 2022 at 7:22 am #7837[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.
July 15, 2022 at 7:41 am #7838BobTags page URL: {{@website.tagsUrl}}
Tags page title: https://getpublii.com/dev/tags-page-tags/
July 15, 2022 at 5:57 pm #7840[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' }}
July 16, 2022 at 4:10 am #7841[anonymous]Thanks Bob and Candide!
Your suggestions worked great. Shows I still have a lot to learn about Publii.
Cheers!
July 16, 2022 at 4:38 am #7843[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. 😊