presta/sitemap-bundle

A symfony 2 bundle that provides tools to build your application sitemap.

Installs: 174 856

Dependents: 4

Stars: 110

Watchers: 27

Forks: 55

Open Issues: 29

Language: PHP

v1.4.0 2015-02-25 14:13 UTC

README

Build Status Scrutinizer Quality Score

Latest Stable Version Total Downloads

SensioLabsInsight PrestaSitemapBundle on Knpbundles

PrestaSitemapBundle is a Symfony2 xml sitemap generator.

:speech_balloon: If you want to have some informations about the projet progression you can register to our google group

Overview

For a ready to use demonstration of PrestaSitemap you should check the prestacms-sandox available on github.

Sandbox is also deployed for a live demonstration :

Requirements

Features

  • Sitemapindex
  • Google images, video, mobile and multilang urls
  • Respect constraints (50k items / 10mB per files)
  • No database required
  • Optionnal caching (using LiipDoctrineCacheBundle, disabled by default)

TL;DR

  1. Installation

        //composer.json
        "require": {
            //...
            "presta/sitemap-bundle": "dev-master"
        }
        //app/AppKernel.php
        public function registerBundles()
        {
            $bundles = array(
                //...
                new Presta\SitemapBundle\PrestaSitemapBundle(),
            );
        }
    #app/config/routing.yml
    PrestaSitemapBundle:
        resource: "@PrestaSitemapBundle/Resources/config/routing.yml"
        prefix:   /
  2. Usage

    For static url there's annotation support in your routes :

    /**
     * @Route("/", name="homepage", options={"sitemap" = true})
     */

    For complexe routes, create a Closure or a Service dedicated to your sitemap then add your urls :

        function(SitemapPopulateEvent $event) use ($router){
            //get absolute homepage url
            $url = $router->generate('homepage', array(), true);
    
            //add homepage url to the urlset named default
            $event->getGenerator()->addUrl(
                new UrlConcrete(
                    $url,
                    new \DateTime(),
                    UrlConcrete::CHANGEFREQ_HOURLY,
                    1
                ),
                'default'
            );
        }
  3. Decorated url (images, videos, etc.)

    The doc is already really short ;)

Documentation

You will find the detailed documentation in the following links :

Ask for help

:speech_balloon: If you need help about this project you can post a message on our google group

Contributing

Pull requests are welcome.

Thanks to everyone who has contributed already.

This project is supported by PrestaConcept

Lead Developer : @alain-flaus

Released under the MIT License

Bitdeli Badge