Get Posts by Tags Querystring Operators
- This topic has 3 replies, 2 voices, and was last updated 5 months, 4 weeks ago by .
- AuthorPosts
- August 29, 2020 at 7:21 pm#3659
stephenfsnow
I’m trying to get posts by a specific combination of tags and I’m wondering if the querystring in the #GetPostsbyTags helper can accept operators in some way? For example I have posts with the tag About and some with the tag City but want to only display posts that contain About AND City filtering out any posts that contain only one of the tags. I attempted to achieve this using the {{#checkIf}} method of getting posts by specific tags but nesting the {{#checkIf}} helper doesn’t seem to work such as in the example below…
{{#each @website.contentStructure.tags}} {{#checkIf this.name '==' 'About'}} {{#checkIf this.name '==' 'City'}} {{#each this.posts}} {{text}} {{/each}} {{/checkIf}} {{/checkIf}} {{/each}}
Any help is appreciated!
August 30, 2020 at 3:02 pm#3662Tomasz Dziuda
ModeratorHi,
Unfortunately it is not possible at this moment with getpostsbytags but I see if it is easily possible to add an operator param which will allow OR and AND values to solve your issues, because it is a good idea 🙂
--
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!August 30, 2020 at 3:05 pm#3663Tomasz Dziuda
ModeratorRelated issue https://github.com/GetPublii/Publii/issues/806
--
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!September 3, 2020 at 3:27 pm#3695stephenfsnow
Awesome! Excited to see this feature in a future release, thank you!
- AuthorPosts
- You must be logged in to reply to this topic.