hasTag
Filter
#Useful when using a layout for multiple collection types, such as to provide a different call to action or link.
Usage within a layout for a single page:
{% if tags | hasTag('post') %}
eleventyConfig.addFilter("hasTag", (tags, tag) => {
return (tags || []).includes(tag);
});
Could be genericized to
hasItem
and used on any array data type.