Developed with love by KnpLabs Hire us for your project!
228

PrestaSitemapBundle

by prestaconcept

A symfony 2 bundle that provides tools to build a rich application sitemap. The main goals are : simple, no databases, various namespace (eg. google image),...

PrestaSitemapBundle

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

Copyright (c) 2012, Prestaconcept

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
presta_sitemap:
timetolive: 3600

# Sets sitemap filename prefix defaults to "sitemap" -> sitemap.xml (for index); sitemap.<section>.xml(.gz) (for sitemaps)
sitemap_file_prefix: sitemap

# Deprecated: please use host option in command. Used for dumper command. Default host to use if host argument is missing
dumper_base_url: http://localhost/
route_annotation_listener: true
  • Update CHANGELOG.md
    By alain-flaus, 2 years ago
  • Merge pull request #76 from prestaconcept/fix-PSR
    By BenoitLeveque, 2 years ago
  • Fix PSR
    By alain-flaus, 2 years ago
  • Merge pull request #71 from emerick42/master
    By BenoitLeveque, 2 years ago
  • Merge pull request #1 from emerick42/features/items-by-set
    By , 2 years ago
  • Create a new unit test on the generator to check its ability to chunk sitemaps
    By emerick42, 2 years ago
  • Update the documentation
    By emerick42, 2 years ago
  • Add the ability to configure the number of items by sitemap
    By emerick42, 2 years ago
  • Update CHANGELOG.md
    By alain-flaus, 2 years ago
  • Merge pull request #58 from pulzarraider/patch-1
    By alain-flaus, 2 years ago
  • Merge pull request #59 from pulzarraider/patch-3
    By alain-flaus, 2 years ago
  • Added Symfony 2.2 and 2.5 to .travis.yml
    By pulzarraider, 3 years ago
  • Remove temporary directory if no urlset was created
    By pulzarraider, 3 years ago
  • Update CHANGELOG.md
    By alain-flaus, 3 years ago
  • Update CHANGELOG.md
    By alain-flaus, 3 years ago
  • Merge pull request #42 from mikemeier/master
    By alain-flaus, 3 years ago
  • Merge pull request #43 from MyHammer/configurableFileNames
    By alain-flaus, 3 years ago
  • checkstyle fixes
    By arosslau, 3 years ago
  • wrapped with preg_quote as recommended by koc
    By arosslau, 3 years ago
  • Merge pull request #48 from Koc/patch-1
    By alain-flaus, 3 years ago
  • Merge pull request #49 from Koc/patch-2
    By alain-flaus, 3 years ago
  • Add Symfony 2.4 to build
    By Koc, 3 years ago
  • Fix AddSitemapListenersPass (possible fix for #47)
    By Koc, 3 years ago
  • allow protected access to member in Dumper
    By , 3 years ago
  • SensioLabsInsight recommandation: Remove @TODO, @see corresponding issues
    By alain-flaus, 3 years ago
  • made constructor backwards compatible
    By arosslau, 3 years ago
  • switched routeLoader to parameter in routing file
    By arosslau, 3 years ago
  • implement configurable filePrefix for routes, too
    By arosslau, 3 years ago
  • make filename of generated sitemap-files configurable in config.yml "sitemap_file_prefix" (fix)
    By andy.rosslau, 3 years ago
  • Travis checkstyle ignore configuration
    By alain-flaus, 3 years ago