Product Title¶
Use product_title
module to insert a title of the currently viewed product on a page. This module is available only within a product card.
Configuration parameters¶
none
Module source code¶
{% from "@macros/section_title.twig" import section_title %}
{% from "@macros/product_title_tag_group.twig" import product_title_tag_group %}
{% set product = ObjectApi.getProduct(product_id) %}
{% set shopUrls = ObjectApi.getShopUrls() %}
{% set availability = product.availability %}
{%
set inactiveClass =
not availability.isAvailable and availability.visibilityConfig.isProductPageGalleryAndNameGrey ?
'product-section-title_inactive inactive' :
''
%}
{% set inlineTitleClass = product.isBundle or product.isDigital ? 'section-title_inline' : '' %}
{% set marginTitleClass = product.isBundle ? 'mr-xs-1' : '' %}
{{ product_title_tag_group(product, { digital: true }) }}
{{ section_title(product.name, { cssClasses: "product-section-title #{inlineTitleClass} #{marginTitleClass} #{inactiveClass}" }) }}
{{ product_title_tag_group(product, { bundle: true }) }}
<script type="application/ld+json">
{
"@context": [
"http://schema.org/",
{ "@base": "{{ shopUrls.mainPageUrl.absolute }}" }
],
"@id": "{{ product.url.relative }}",
"@type": "http://schema.org/Product",
"offers": {
"@id": "{{ product.url.relative }}",
"@type": "Offer",
"url": "{{ product.url.absolute }}"
}
}
</script>
<script type="application/ld+json">
{
"@context": [
"http://schema.org/",
{ "@base": "{{ shopUrls.mainPageUrl.absolute }}" }
],
"@id": "{{ product.url.relative }}",
"name": "{{ product.name }}"
}
</script>
The module uses JSON-LD and Microdata from schema.org to optimize search results in browsers.