/SitemapBundle

A symfony bundle for thepixeldeveloper/sitemap

Primary LanguagePHPMIT LicenseMIT

Thepixeldeveloper\SitemapBundle

pipeline status coverage report License Latest Stable Version Total Downloads

A symfony bundle that integrates thepixeldeveloper/sitemap.

Installation

  1. Require as a composer dependency:

    composer require "thepixeldeveloper/sitemap-bundle"
  2. Register the bundle:

    # app/AppKernel.php
    public function registerBundles()
    {
        $bundles = [
            new Thepixeldeveloper\SitemapBundle\ThepixeldeveloperSitemapBundle(),
        ];
    }
  3. Import routing

    # app/config/routing.yml
    thepixeldeveloper_sitemap_bundle:
        resource: "@ThepixeldeveloperSitemapBundle/Resources/config/routing.yml"
        prefix:   /
  4. Define where the XML files will be dumped.

    thepixeldeveloper_sitemap:
        directory: '%kernel.project_dir%/var/sitemaps'

Usage

  1. Create an event listener for theixeldeveloper_sitemap.populate. Add Urls to the Urlset collection.

  2. Sitemaps are generated as follows:

    ./bin/console thepixedeveloper:sitemap:dump
  3. Your sitemap will be accessible at: https://domain.tld/sitemap.xml