2017 © Pedro Peláez
 

sylius-plugin sitemap-plugin

Sitemap Plugin for Sylius

image

stefandoorn/sitemap-plugin

Sitemap Plugin for Sylius

  • Sunday, June 17, 2018
  • by stefandoorn
  • Repository
  • 2 Watchers
  • 22 Stars
  • 5,883 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 10 Forks
  • 1 Open issues
  • 26 Versions
  • 58 % Grown

The README.md

Sylius Sitemap Plugin

License Version Build Coverage Status, (*1)

, (*2)

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., (*3)

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/config/bundles.php:
  SitemapPlugin\SitemapPlugin::class => ['all' => true],
  1. Add to app/config/packages/_sylius.yaml:
    - { resource: "@SitemapPlugin/Resources/config/config.yaml" }
  1. Add to app/config/routes.yaml:
sylius_sitemap:
    resource: "@SitemapPlugin/Resources/config/routing.yml"
  1. Add to app/config/packages/sylius_sitemap.yaml:
  1. Forcing HTTPS on Generated URLs, see Symfony Docu. In console commands, where there is no HTTP request, URLs use http by default. You can change this globally with these configuration parameters:
# config/services.yaml
parameters:
    router.request_context.scheme: 'https'

Usage

Generate your sitemap from the CLI:, (*4)

 $ bin/console sylius:sitemap:generate

Add this command to your cronjob to regularly generate a new sitemap, e.g. once a day., (*5)

If you only want to generate the sitemap for a specific channel, use:, (*6)

 $ bin/console sylius:sitemap:generate --channel=US_WEB

The plugin defines three default URI's:, (*7)

  • sitemap.xml: redirects to sitemap_index.xml
  • sitemap_index.xml: renders the sitemap index file (with links to the provider xml files)

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

Default Configuration

Get a full list of configuration: bin/console config:dump-reference sitemap, (*9)

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: [] }

The request context is also important for generating the URLs inside the sitemap:, (*10)

  • The hostname is defined per channel, if nothing set it defaults to localhost
  • Other request context settings can be adjusted as mentioned in the Symfony docs

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., (*11)

Feature switches

  • providers: Enable/disable certain providers to be included in the sitemap. Defaults are true.
  • exclude_taxon_root: Often you don't want to include the root of your taxon tree as it has a generic name as 'products'.
  • hreflang: Whether to generate alternative URL versions for each locale. Defaults to true. Background: https://support.google.com/webmasters/answer/189077?hl=en.
  • images: Whether to add images to URL output in case the provider adds them. Defaults to true. Background: https://support.google.com/webmasters/answer/178636?hl=en.

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

The Versions

06/04 2018
27/02 2018

dev-code-improvements-static-sitemap

dev-code-improvements-static-sitemap

Sitemap Plugin for Sylius

  Sources   Download

MIT

The Requires

 

The Development Requires

26/02 2018

dev-test-against-symfony-3.3-also

dev-test-against-symfony-3.3-also

Sitemap Plugin for Sylius

  Sources   Download

MIT

The Requires

 

The Development Requires

26/02 2018

dev-test-against-sylius-versions

dev-test-against-sylius-versions

Sitemap Plugin for Sylius

  Sources   Download

MIT

The Requires

 

The Development Requires

26/02 2018
01/12 2017

dev-symfony-3-and-4

dev-symfony-3-and-4

Sitemap Plugin for Sylius

  Sources   Download

MIT

The Requires

 

The Development Requires

27/10 2017

dev-fix-locales-parameters-config

dev-fix-locales-parameters-config

Sitemap Plugin for Sylius

  Sources   Download

MIT

The Requires

 

The Development Requires

01/08 2017