nouvelletechno/sitemap-bundle

This bundle helps you generating a sitemap.xml file for your Symfony application

0.2.0 2020-08-21 15:13 UTC

This package is auto-updated.

Last update: 2024-04-08 22:13:58 UTC


README

Bundle that generates dynamic sitemap.xml content with simple yaml configuration.

Codacy Badge CodeFactor

Installation

# composer require NouvelleTechno/sitemap-bundle

Update your routing

Add a sitemap.yaml file inside config/routes and include the below content to enable new route

sitemap:
    resource: '@SitemapBundle/Controller/SitemapController.php'
    type: annotation

The bundle will then listen to /sitemap.xml and generate the sitemap by itself

Usage

The bundle generates a sitemap based on YAML configuration.

Add a sitemap.yaml file inside config/packages and customize the below example to enable your sitemap

sitemap:
    routes:
        # List here the different routes you want to include in the sitemap
        # Single route without parameters
        - { route: 'demos_index' }

        # Route that requires parameters
        - { route: 'demos_show', entity: 'Demos', parameters: 'id' }

        # Route with priority and frequency
        # Priority between 0 and 1
        # Frequency should be 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly' or 'never'
        - { route: 'demos_show', entity: 'Demos', parameters: 'id', frequency: 'monthly', priority: 0.5 }