Title and Metadata
The module provides functionality for managing page titles, meta tags, and other metadata from Prismic content.
Components
Canonical Block
Generates canonical URLs for Prismic content.AlternateLanguage Block
Handles hreflang tags for multilingual content.Implementation
Layout Integration
<referenceBlock name="head.additional">
<block name="prismicio_alternate_links"
class="Elgentos\PrismicIO\Block\AlternateLanguage"
template="alternate_links.phtml" />
<block name="prismicio_canonical"
class="Elgentos\PrismicIO\Block\Canonical"
template="canonical.phtml" />
</referenceBlock>
Metadata Handling
The module can handle various metadata: - Page titles - Meta descriptions - Open Graph tags - Twitter cards - Canonical URLs - Alternate language links
Usage Examples
Page Title
<referenceBlock name="page.main.title">
<block class="Elgentos\PrismicIO\Block\Dom\Plain"
template="data.meta_title"/>
</referenceBlock>
Meta Description
<referenceBlock name="head.additional">
<block class="Elgentos\PrismicIO\Block\Metadata"
name="prismic.metadata">
<arguments>
<argument name="reference" xsi:type="string">data.meta_description</argument>
</arguments>
</block>
</referenceBlock>
Best Practices
- SEO Optimization
- Always provide meta descriptions
- Use proper canonical URLs
-
Implement hreflang correctly
-
Multi-store Support
- Handle store-specific metadata
- Consider language variations
-
Maintain consistent URLs
-
Performance
- Cache metadata appropriately
- Optimize metadata generation
- Monitor page load impact