Skip to content

cpa99dcs/Sitemap

 
 

Repository files navigation

Soflomo\Sitemap

Soflomo\Sitemap is a simple sitemap generation module for Zend Framework 2. It provides a html version and XML version of the sitemap using Zend\Navigation.

Installation

Soflomo\Sitemap can be loaded via composer. Require soflomo/sitemap. The current version is tagged as 0.1.0, so you can use the constraint >=0.1.0,<0.2.0-dev.

    "require": {
        "soflomo/sitemap": ">=0.1.0,<0.2.0-dev",
    }

After the module is loaded, do not forget to enable it in your application.config.php under the module name Soflomo\Sitemap.

    return array(
        'modules' => array(
            // ...
            'Sitemap',
        ),
        // ...
    );

Usage

Add a navigation container to the Application module.config.php or the application.config.php outlining your application sitemap:

    return array(
        'navigation' => array(
            'default' => array(
                array(
                    'label' => 'Home',
                    'route' => 'home',
                    'lastmod' => '2013-09-09',
                    'changefreq' => 'daily',
                    'priority' => '0.5',
                ),
                array(
                    'label' => 'About',
                    'route' => 'about',
                    'lastmod' => '2013-09-09',
                    'changefreq' => 'daily',
                    'priority' => '0.5',
                ),
                array(
                    'label' => 'Services',
                    'controller' => 'services',
                    'pages' => array(
                        array(
                            'label' => 'Basic',
                            'action' => 'basic',
                            'controller' => 'services',
                            'class' => 'sub-menu',
                            'title' => 'Basic Service',
                            'active' => true,
                        ),
                        array(
                            'label' => 'Advanced',
                            'action' => 'advanced',
                            'controller' => 'services',
                            'class' => 'sub-menu',
                            'title' => 'Advanced Service',
                            'active' => true,
                        ),
                    ),
                ),
                array(
                    'label' => 'Contact',
                    'route' => 'contact',
                    'lastmod' => '2013-09-09',
                    'changefreq' => 'daily',
                    'priority' => '0.5',
                ),
            },
        ),
        // ...
    );

Visit /sitemap for the html version. The /sitemap/xml is the XML version for the sitemap. Soflomo\Sitemap uses the default navigation container. If you want to set another container to be rendered, inject this container in the navigation view helper prior to the dispatch of the Soflomo\Sitemap\Controller\SitemapController.

About

Sitemap module for Zend Framework 2

Resources

License

Stars

Watchers

Forks

Packages

No packages published