I am building a site with menus to display posts related to a tag.
I want to display the posts in a different order depending on the menu the visitor clicks on.
Is there a way to implement this?
Thanks in advance for your help!
It seems to me that the easiest way to do this would be just to display tag pages.
For example, let’s say you have posts about dogs and cats:
add to the menu two items: the dog and cat tag.
these pages will now display all posts related to those tags.
--
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!
Of course, that’s what I did.
But I would like to sort the posts related to cats in one way (e.g. on the date of publication) and those related to dogs on another criterion (e.g. by alphabetical order of titles).
How do I do this?
By default, it’s not possible. But I think you can create dedicated tag-templates for dog and cat categories with the getPostsByTags helper.
--
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!
--
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!
Add in it:
“tagTemplates”: {
“TEMPLATE_SLUG”: “Tri des tags par libelle”
},
choose
create tag-TEMPLATE_SLUG.hbs file in the same directory by copy of tag.hbs
I tried many places for the following code, without success:
{{#getPostsByTags “count=-1&allowed=hidden,featured&tag_as=id&tags=10&orderby=modifiedAt&ordering=desc”}}
{{/getPostsByTags}}
I definitely don’t understand how to embed this code in the tag.hbs page… Any help will be very appreciated. Thanks in advance.