Skip to content

Sitemap Plugin for Sylius eCommerce platform

License

Notifications You must be signed in to change notification settings

Roshyo/sitemap-plugin

 
 

Repository files navigation

Sylius Sitemap Plugin

License Version Build status on Linux Scrutinizer Quality Score Coverage Status

Big thanks

Goes out to the Sylius team. The core code of this plugin is created by the Sylius team. Unfortunately it got removed from the Sylius core. Luckily the Sylius team approved the extraction to a separate bundle.

Features

  • Creates a sitemap index file to point to sub sitemap files per type of data
  • Default providers: taxons, products & static content (homepage & contact)
  • Easily add your own providers
  • Product provider supports locales (hreflang) & is channel aware
  • Taxon provider supports locales (hreflang)

Installation

  1. Run composer require stefandoorn/sitemap-plugin.
  2. Add to app/AppKernel.php:
  new SitemapPlugin\SitemapPlugin(),
  1. Add to app/config/config.yml:
  - { resource: "@SitemapPlugin/Resources/config/config.yml" }
  1. Add to app/config/routing.yml:
sylius_sitemap:
     resource: "@SitemapPlugin/Resources/config/routing.yml"

Usage

The plugin defines three default URI's:

  • sitemap.xml: redirects to sitemap_index.xml
  • sitemap_index.xml: renders the sitemap index file (with links to the provider xml files)
  • sitemap/all.xml: renders all the URI's from all providers in a single response

Next to this, each provider registeres it's own URI. Take a look in the sitemap index file for the correct URI's.

Default configuration

Get a full list of configuration: bin/console config:dump-reference sitemap

sitemap:
    providers:
        products: true
        taxons: true
        static: true
    template:             '@SitemapPlugin/show.xml.twig'
    index_template:       '@SitemapPlugin/index.xml.twig'
    exclude_taxon_root:   true
    hreflang:             true
    images:               true
    static_routes:
        - { route: sylius_shop_homepage, parameters: [], locales: [] }
        - { route: sylius_shop_contact_request, parameters: [], locales: [] }

Default storage

By default the sitemaps will be saved in %kernel.root_dir%/var/sitemap. You can change this setting by adjusting the parameter sylius.sitemap.path.

Feature switches

Default providers

  • Products
  • Taxons
  • Static content (homepage & contact)

Add own provider

  • Register & tag your provider service with sylius.sitemap_provider
  • Let your provider implement UrlProviderInterface
  • Use one of the default providers as an example to implement code

About

Sitemap Plugin for Sylius eCommerce platform

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 94.9%
  • HTML 3.2%
  • JavaScript 1.9%