Skip to content

Sitemap Integration

The Prismic module integrates with Magento's sitemap functionality to automatically include your Prismic content in your store's XML sitemap.

Configuration

Basic Setup

  1. Go to Stores > Configuration > Elgentos > Prismic.IO
  2. Navigate to the Sitemap section
  3. Select which content types to include in the sitemap

Sitemap Settings

Configure sitemap-specific settings under Stores > Configuration > Catalog > XML Sitemap:

  1. Frequency
  2. How often the content is updated
  3. Default: 'daily'
  4. Options: always, hourly, daily, weekly, monthly, yearly, never

  5. Priority

  6. Priority relative to other URLs
  7. Default: '0.25'
  8. Valid values: 0.0 to 1.0
<sitemap>
    <prismic>
        <priority>0.25</priority>
        <changefreq>daily</changefreq>
    </prismic>
</sitemap>

Content Type Selection

Including Content Types

Specify which content types should appear in the sitemap:

<prismicio>
    <sitemap>
        <content_types>blog_post,landing_page,product_story</content_types>
    </sitemap>
</prismicio>

Multi-store Support

The module handles multi-store setups: - Generates store-specific URLs - Respects store-specific language settings - Handles store-specific content types

Technical Details

URL Generation

The module: 1. Queries each configured content type 2. Generates proper URLs using the LinkResolver 3. Includes last publication date from Prismic 4. Applies store-specific URL formatting

Example Output

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>https://example.com/blog/summer-trends</loc>
        <lastmod>2024-01-15T10:30:00+00:00</lastmod>
        <changefreq>daily</changefreq>
        <priority>0.25</priority>
    </url>
    <!-- Additional URLs... -->
</urlset>

Implementation

Automatic Integration

The module automatically integrates with Magento's sitemap generation:

// PrismicPages implements ItemProviderInterface
class PrismicPages implements ItemProviderInterface
{
    public function getItems($storeId): array
    {
        // Fetches all configured content types
        // Generates sitemap items
        // Returns formatted array for sitemap
    }
}

Custom Implementation

You can extend the default behavior:

class CustomPrismicPages extends PrismicPages
{
    protected function getSitemapContentTypes($store): array
    {
        // Your custom logic for content types
        return array_filter($customContentTypes);
    }
}

Best Practices

  1. Content Type Selection
  2. Include only publicly accessible content
  3. Consider content update frequency
  4. Exclude temporary or test content

  5. Priority Setting

  6. Set higher priority for main content (0.8-1.0)
  7. Use medium priority for regular content (0.4-0.7)
  8. Lower priority for auxiliary content (0.1-0.3)

  9. Update Frequency

  10. Match changefreq to actual content updates
  11. Use appropriate frequency for content type
  12. Consider content lifecycle

  13. Performance

  14. Monitor sitemap size
  15. Use pagination for large content sets
  16. Consider caching strategies

Troubleshooting

  1. Missing Content
  2. Verify content type is enabled in configuration
  3. Check content is published in Prismic
  4. Confirm proper store assignment

  5. Invalid URLs

  6. Check LinkResolver configuration
  7. Verify store URL settings
  8. Review content type routing

  9. Generation Issues

  10. Check Magento cron is running
  11. Verify file permissions
  12. Monitor memory usage for large sitemaps

Maintenance

  1. Regular Tasks
  2. Review included content types
  3. Update priorities based on analytics
  4. Monitor sitemap size and generation time

  5. Optimization

  6. Remove unnecessary content types
  7. Adjust update frequencies
  8. Clean up old/unused URLs