Download the PHP package dpn/xml-sitemap-bundle without Composer
On this page you can find all versions of the php package dpn/xml-sitemap-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package xml-sitemap-bundle
DpnXmlSitemapBundle
This bundle generates XML sitemaps for your favourite search engine by extracting sitemap information out of your application's routes. Additionally, you can create your own generators to provide URLs. The sitemap(s) generated follow the sitemap protocol.
Installation
-
Install with composer:
composer require dpn/xml-sitemap-bundle
-
Enable the bundle in the kernel:
- Register the routing in
app/config/routing.yml
(this step is optional if using the console command to pre-generate the sitemaps)
Usage
Exposing Routes
To expose a route to the sitemap add the option sitemap
to your route definition:
This will expose this route to your sitemap using the default options from your config. To control the options
for this sitemap entry, add them to the sitemap
option:
NOTE: Only routes without parameters may be exposed in this way. For routes with parameters, you must create a custom generator (see below).
Custom Generator
For more complex routes that have parameters, you must create a custom generator.
-
Create a generator class that implements
Dpn\XmlSitemapBundle\Sitemap\GeneratorInterface
. This class must have agenerate()
method that returns an array ofDpn\XmlSitemapBundle\Sitemap\Entry
objects. - Add this class as a service tagged with
dpn_xml_sitemap.generator
:
Sitemap Index
According to sitemaps.org the maximum number of entries a sitemap.xml
may have is 50,000. When the number of sitemap entries exceeds this, the entries are split across multiple sitemaps
(ie /sitemap1.xml
,/sitemap2.xml
.../sitemapN.xml
).
A sitemap index is accessible at /sitemap_index.xml
.
The maximum entries per sitemap is configurable:
HTTP Caching
You can enable http caching for the sitemap(n).xml
/sitemap_index.xml
URI's by setting the number of
seconds in your config:
Console Dump Command
The dpn:xml-sitemap:dump
command is available to pre-generate sitemap.xml files:
NOTE: The command requires Symfony 2.4+.
Full Default Configuration
The following is the default configuration for this bundle:
License
See Resources/meta/LICENSE
.
All versions of xml-sitemap-bundle with dependencies
symfony/twig-bundle Version ^2.7|^3.0
symfony/dependency-injection Version ^2.7|^3.0
symfony/templating Version ^2.7|^3.0
symfony/asset Version ^2.7|^3.0