Skip to content

Title and Metadata

The module provides functionality for managing page titles, meta tags, and other metadata from Prismic content.

Components

Canonical Block

Elgentos\PrismicIO\Block\Canonical
Generates canonical URLs for Prismic content.

AlternateLanguage Block

Elgentos\PrismicIO\Block\AlternateLanguage
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

  1. SEO Optimization
  2. Always provide meta descriptions
  3. Use proper canonical URLs
  4. Implement hreflang correctly

  5. Multi-store Support

  6. Handle store-specific metadata
  7. Consider language variations
  8. Maintain consistent URLs

  9. Performance

  10. Cache metadata appropriately
  11. Optimize metadata generation
  12. Monitor page load impact