A symfony bundle that integrates thepixeldeveloper/sitemap.
-
Require as a composer dependency:
composer require "thepixeldeveloper/sitemap-bundle"
-
Register the bundle:
# app/AppKernel.php public function registerBundles() { $bundles = [ new Thepixeldeveloper\SitemapBundle\ThepixeldeveloperSitemapBundle(), ]; }
-
Import routing
# app/config/routing.yml thepixeldeveloper_sitemap_bundle: resource: "@ThepixeldeveloperSitemapBundle/Resources/config/routing.yml" prefix: /
-
Define where the XML files will be dumped.
thepixeldeveloper_sitemap: directory: '%kernel.project_dir%/var/sitemaps'
-
Create an event listener for
theixeldeveloper_sitemap.populate
. Add Urls to the Urlset collection. -
Sitemaps are generated as follows:
./bin/console thepixedeveloper:sitemap:dump
-
Your sitemap will be accessible at: https://domain.tld/sitemap.xml