Closed candidexmedia closed 9 months ago
@candidexmedia - it will be available on v.0.45 as:
{{#each mainTags}}
...
{{/each}}
It will work like {{#each tags}}...{{/each}}
but will be limited only to tags set as main tag :)
Amazing, thank you!
Hi @dziudek! Is it possible to exclude mainTags from an array, like:
{{if its a tag}}
{{#each tag EXCEPT mainTags}}
...
{{/each}}
{{/if}}
or
{{getTags isNot mainTag}}
..
@candidexmedia - there is unfortunately no simple way.
The easiest solution would be creating a custom helper https://getpublii.com/dev/how-to-create-a-custom-helper/ which receives mainTags and ID of tag to check - something like:
mainTagChecker: function(mainTags, id) {
return mainTags.some(tag => tag.id === id);
}
And then use it as:
{{#if tags}}
{{#each tags}}
{{#unless (mainTagsChecker mainTags this.id)}}
<a href="{{url}}">{{name}}</a>
{{/unless}}
{{/each}}
{{/if}}
In Publii v.0.46 I will try to add some flag like "isMainTag" to the tags object
Thank you for the help @dziudek!
cc: @3muchfun
Feature Description
Hello! This feature request hopes to address the confusion surrounding the filter by Maintags function found in certain themes:
Many believe that filtering posts by their Maintag means that only Maintags will be displayed in the list of filters, but that isn't the case (or possible at the moment). My wish would be to have some kind of helper similar to
#each tags
, but for maintags (ie#each maintag
).