Sitemap adjustments via config.php

You have the possibility to define exclusions for the sitemap via config.php or add your own URLs.
You can find the config.php in the Shopware main directory on the web server.

Please note that due to incorrect entries in the config.php your shop may not be able to be accessed (correctly). Therefore we recommend that only experienced users carry out the adjustments described below.

Add an additional URL

To integrate an additional URL into the sitemap, an entry of the type custom_urls is added.
The following information is required:

  • url: The desired URL to be included in the sitemap
  • priority: Priority of this URL compared to other URLs of your shop. This has no effect on the comparison to other websites/shops. Valid entries are values between 0 and 1; the default is 0.5
  • changeFreq: How often is the content of the page expected to change. Possible are: always, hourly, daily, weekly, monthly, yearly, never
  • lastMod: Date when the page was last modified. Format Y-m-d H:i:s
  • shopId: For which Shop-ID should the URL be written in the sitemap? 0 = all shops. You can find the IDs of the shops in the database table "s_core_shops" in the column "id".

Example

The URL "myUrl.de" should be integrated for all shops. As priority 0.4 is deposited and the change is to take place weekly.


'sitemap' => [
        'custom_urls' => [
            [
                'url' => 'myUrl.com',
                'priority' => 0.4,
                'changeFreq' => 'weekly',
                'lastMod' => '2019-01-01 12:00:12',
                'shopId' => 0
            ]
        ]
    ],

Remove certain URLs from the sitemap

If certain pages should not be listed in the sitemap, this can be defined in more detail using excluded_urls.
The following information is required for this:

  • resource: Defines which page type should be excluded. Possible:
    • '\Shopware\Models\Article\Article::class': Exclusion of products.
    • '\Shopware\Models\Emotion\Emotion::class': exclusion of shopping worlds.
    • '\Shopware\Models\Article\Supplier::class': exclusion of manufacturer pages.
    • '\Shopware\Models\Blog\Blog::class': exclusion of blog articles.
    • '\Shopware\Models\Category\Category::class': exclusion of category pages.
    • \Shopware\Models\Site\Site::class': exclusion of shop pages.
  • identifier: The ID of the selected resource. 0 = completely excluded. The IDs of the entities from the resource can be found in the following places
    • product: Database table "s_articles" in the column "id
    • campaign: database table "s_emotion" in the column "id".
    • manufacturer: database table "s_articles_supplier" in the column "id".
    • blog: database table "s_blog" in the column "id
    • category: In the backend in the category administration in the heading "General Settings" in the entry System ID. Or in the database table "s_categories" in the column "id".
    • static: In the backend in the shop page administration (Contents > shop pages) in the menu on the left side in brackets behind the name of the shop page. Or in the database table "s_cms_static" in the column "id".
  • shopId: The ID of the shop for which the exclusion should apply. 0 = exclusion for all shops. You can find the IDs of the shops in the database table "s_core_shops" in the column "id".

Example

Product
The product with ID 123 should not be included in the sitemap of the shop with ID 2.
 


    'sitemap' => [
        'excluded_urls' => [
            [
               'resource' => \Shopware\Models\Article\Article::class,
               'identifier' => '123',
               'shopId' => 2
            ],
        ]
    ],


Shopping world
The shopping world with the ID 21 is to be removed from the sitemap for all shops.


    'sitemap' => [
        'excluded_urls' => [
            [
               'resource' => \Shopware\Models\Emotion\Emotion::class,
               'identifier' => '21',
               'shopId' => 0
            ],
        ]
    ],


Category and shop pages combined
The category with the ID 246 and all shop pages should be removed from the sitemap for all shops.


    'sitemap' => [
        'excluded_urls' => [
            [
               'resource' => \Shopware\Models\Category\Category::class,
               'identifier' => '246',
               'shopId' => 0
            ],
            [
               'resource' => \Shopware\Models\Site\Site::class,
               'identifier' => '0',
               'shopId' => 0
            ],
        ]
    ],

Was this article helpful?