2017 © Pedro Peláez
 

symfony-bundle sitemap-bundle

Web-IT Sitemap Bundle

image

webit/sitemap-bundle

Web-IT Sitemap Bundle

  • Saturday, January 27, 2018
  • by dbojdo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 74 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

sitemap-bundle

Sitemap Symfony 2 Integration, (*1)

Installation

Composer: add the webit/sitemap-bundle into composer.json

{
    "require": {
        "php":              ">=5.3.2",
        "webit/sitemap-bundle": "dev-master"
    }
}

Usage

Register bundle in Kernel

Add following lines:, (*2)

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new Webit\Bundle\SitemapBundle\WebitSitemapBundle(),
    // ...
);

Create your implementation of Webit\Sitemap\Exposer\UrlExposerInterface

namespace MyProject;

use Webit\Sitemap\Exposer\UrlExposerInterface;
use Webit\Sitemap\Model\UrlSet;
class MyExposer implements UrlExposerInterface
{
    /**
     * @return UrlSet
     */
    public function getUrlSet()
    {
        $urlSet = new UrlSet();

        $url = new Url();
        $url->setLocation('http://page.url/my-site');
        $urlSet->addUrl(new Url());

        // add to $urlSet all urls you need 

        return $urlSet;
    }
}

Register your UrlExposer in a Service Container and tag it as webit_sitemap.url_exposer


<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services
        http://symfony.com/schema/dic/services/services-1.0.xsd">

    <parameters>
        <parameter key="my_project.my_exposer.class">MyProject\MyExposer</parameter>
    </parameters>

    <services>
        <service id="my_project.my_exposer" class="%my_project.my_exposer.class%">
            <tag name="webit_sitemap.url_exposer" />
        </service>
    </services>
</container>

or, (*3)

parameters:
    my_project.my_exposer.class: MyProject\MyExposer

services:
    my_project.my_exposer:
        class: %my_project.my_exposer.class%
        tags:
            - { name: webit_sitemap.url_exposer }

Import sitemap routings

sitemap:
    prefix: /
    resource: @WebitSitemapBundle/Resources/config/routing.xml

Go to http://your-domain.com/sitemap to see generated file

The Versions

27/01 2018

dev-master

9999999-dev http://www.web-it.eu

Web-IT Sitemap Bundle

  Sources   Download

MIT Web-IT

The Requires

 

sitemap web-it

27/01 2018

0.11.x-dev

0.11.9999999.9999999-dev http://www.web-it.eu

Web-IT Sitemap Bundle

  Sources   Download

MIT Web-IT

The Requires

 

sitemap web-it