Skip to content
Generate sitemaps for you site.
PHP
Pull request Compare This branch is 1 commit behind iostudio:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
config
lib/task
test
LICENSE
README
package.xml.tmpl

README

ioSitemapGeneratorPlugin
========================

This plugin is used to generate sitemaps for any of your symfony web sites. Once
installed and configured, just run the task generate:sitemap and this task will
create a sitemap.xml in symfony's web directory.

Requirements
------------

* sfDoctrinePlugin
* DOM extension for php (http://us2.php.net/manual/en/book.dom.php)

Installation
------------

    git submodule add REPO_URL plugins/ioSitemapGeneratorPlugin

Now open your ProjectConfiguration.class.php

    // config/ProjectConfiguration.class.php
    ...
      $this->enablePlugins(array(
        ...
        'ioSitemapGeneratorPlugin',
        ...
      ));
    ...

Configuration
-------------

Set the configuration options in the app.yml. You must have the routes setup in
your routing.yml. You will need to set what host you want as well as setup what
urls and models you want included in the sitemap.xml. changefreq and priority are
both optional.

Setting your host
^^^^^^^^^^^^^^^^^

    # apps/frontend/config/app.yml
    all:
      ioSitemapGenerator:
        sf_host: http://www.iostudio.com

The reason you must set your host here is because without an incoming request,
symfony does not know that the website is.

NOTE: The same thing can be accomplished using the routing factory, however
we felt that doing it this way was a better solution.

Adding URLs
^^^^^^^^^^^

Urls are pages that are not tied to any model.

    # apps/frontend/config/app.yml
    all:
      ioSitemapGenerator:
        urls:
          -
            route: homepage
            changefreq: daily
            priority: 1.0
          -
            route: about
            changefreq: monthly
            priority: 1.0

*route* is the name of the route in your routing.yml file. *changefreq* is the
frequency in how much the page changes, see the sitemaps.org site. *priority*
is on a scale of 0.0 to 1.0.

Adding Doctrine Routes
^^^^^^^^^^^^^^^^^^^^^^

    # apps/frontend/config/app.yml
    all:
      ioSitemapGenerator:
        models:
          -
            model: BlogPost
            route: blog_post_show
            changefreq: weekly
            priority: 0.5
          -
            model: BlogTag
            route: blog_tag_show
            changefreq: weekly
            priority: 0.5

*model* is what model the route is based on. *route* must be defined in your
routing.yml file. *changefreq* is the frequency of how much the page updates.
*priority* is a scale of 0.0 to 1.0 of how important the page is.

NOTE: If the model has the column updated_at (ie actAs Timestampable) then it
will place this in the sitemap file automatically. To disable this feature you
can just add *include_lastmod: false* when defining the models.

Tasks
-----

This plugin only comes with one task.

generate:sitemap
^^^^^^^^^^^^^^^^

Running this task will create a sitemap.xml file in the symfony web directory. For
more help about this task, just run ./symfony help generate:sitemap

References
----------

  * http://www.sitemaps.org
  * http://www.sitemaps.org/protocol.html#xmlTagDefinitions
Something went wrong with that request. Please try again.