Blog Article Tags¶
blog_article_tags
module is used to display tags for a currently viewed blog article and is only available within a blog article page.
Configuration parameters¶
title¶
string
A title of the module
Module source code¶
{% from "@macros/module_accordion_toggler.twig" import module_accordion_toggler %}
{% from "@macros/tag.twig" import tag %}
{% set article = ObjectApi.getBlogArticle(news_id) %}
{% set shopUrls = ObjectApi.getShopUrls() %}
{% if article.tags|length > 0 %}
<h-accordion class="accordion" disabled>
<h-accordion-group opened>
{% if moduleConfig.title %}
<h2 class="module__header blog-article-tags__header">
{{ module_accordion_toggler({ title: moduleConfig.title, isDisabled: true }) }}
</h2>
{% endif %}
<h-accordion-content>
<div class="blog-article-tags">
{% for tag in article.tags %}
<a class="blog-article-tags__tag" href="{{ tag.url }}">
{{
tag(
tag.name,
{
clickable: true,
secondary: true
}
)
}}
</a>
{% endfor %}
</div>
</h-accordion-content>
</h-accordion-group>
</h-accordion>
{% endif %}
{% set keywords = '' %}
{% for tag in article.tags %}
{% set keywords = keywords ~ "#{loop.first ? '' : ','} #{tag.name}" %}
{% endfor %}
<script type="application/ld+json">
{
"@context": [
"http://schema.org/",
{ "@base": "{{ shopUrls.mainPageUrl.absolute }}" }
],
"@id": "{{ article.url.relative }}",
"@type": "Article",
"keywords": "{{ keywords }}"
}
</script>
The module uses JSON-LD and Microdata from schema.org to optimize search results in browsers.
Macros reference¶
Used Object Api methods¶
Used styles¶
Module configuration schema¶
[
{
"state": "unfolded",
"label": "General settings",
"elements": [
{
"type": "infobox",
"name": "infobox",
"options": {
"type": "blank",
"message": "#### Related settings in the admin panel%s- adding and editing blog entries in the [List of entries](%s)",
"placeholderValues": [
"\n",
"\/admin\/news\/list"
]
}
},
{
"type": "text",
"name": "title",
"label": "Module title",
"supportsTranslations": 1,
"isRequired": 1,
"defaultValue": "Tags"
}
]
}
]