A tag is used to indicate that certain content is related to a certain subject by using a specific keyword.
For instance, if a piece of content is related to recycling, a tag could be used with the keyword “recycling”, to indicate that the piece of content is related to recycling.
A tag allows to quickly scan on overviews which pieces of content are or aren’t related to a certain subject. It also allows to generate specific overviews with all content about a certain subject. On detail pages, a tag shows what subject the page is about.
There are three types of tags, each with a unique use and presentation:
The default tag is used on detail pages to indicate that the content on that detail page is about the specific subject that is represented by the tag. One or more defaull tags can be used.
On detail pages, the default tags are also shown as an indicator that there is other content on the website about the same subject(s). Each default tag therefore has a link to an overview page that collects all content about the specific subject that is represented by the tag.
The filter tag is used on pages using the filter layout to indicate active filters. One or more filter tags can be shown if the page features one or more filters. Everytime the user selects a filter value the corresponding filter tag is shown to show the filter is active. Everytime the user deselects a filter value, the corresponding filter tag is hidden again to show that the filter is no longer active. This way, the user always has an easy way to see which filters are active at a specific point. Finally, the user can also click a filter tag to deselect the corresponding filter.
The span tag is used in teasers, typically in a teaser collection on overview pages, to show that the content that the teaser represents is about the specific subject that is represented by the tags. In a teaser, one or more span tags can be used. Span tags are not clickable, they just serve a visual mean on overview page to show that content is related to a specific subject.
{% if type == 'tag' %}
<a href="javascript:(void);" class="tag {{ modifier }}">
{{ tag_text }}
</a>
{% endif %}
{% if type == 'external-tag' %}
<a href="https://external.link" class="tag {{ modifier }}">
{{ tag_text }}
</a>
{% endif %}
{% if type == 'filter-tag' %}
<span class="tag filter {{ modifier }}">
{{ tag_text }}
<button><span class="visually-hidden">{{ 'Remove ' ~ tag_text }}</span></button>
</span>
{% endif %}
{% if type == 'span-tag' %}
<span class="tag {{ modifier }}">
{{ tag_text }}
</span>
{% endif %}
<a href="javascript:(void);" class="tag ">
Inner city
</a>
{
"tag_text": "Inner city",
"type": "tag"
}
.tag {
@include theme('background-color', 'color-secondary', 'tag-background-color');
@include medium-text();
display: inline-flex;
align-items: center;
justify-content: space-between;
padding: 8px 15px;
line-height: 1.1;
text-decoration: none;
&.filter {
@include theme('background-color', 'color-tertiary-pastel', 'button-secondary-background');
padding-top: 3px;
padding-bottom: 3px;
&:hover button {
@include theme('background-color', 'color-quaternary', 'tag-close-button-background-hover');
}
button {
width: 20px;
height: 20px;
margin-left: 5px;
padding: 0;
transition: background-color .2s ease-in-out;
border: 0;
border-radius: 100%;
background: transparent svg-as-background('cross', color('gray'), 16, 16);
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
}
}
}
a.tag {
@include theme('color', 'color-zero', 'tag-color');
@include normal-text();
padding: 8px 15px;
border: 0;
&:not([class*=icon])::before {
margin-left: 5px;
}
&:hover {
@include theme('background-color', 'color-secondary--lighten-1', 'tag-hover-background');
}
&::after {
margin-left: 5px;
}
}
span.tag {
@include small-text();
height: 30px;
padding-right: 10px;
padding-left: 10px;
}