Remove canonical on paginated content in Shopware

How to remove canonical from paginated content to follow technical best-practices. Page 1 is not equal to page 2, and it therefore should not be defined as the canonical URL.


By. Jacob

Edited: 2023-10-05 23:26

To follow technical best practices, URLs containing paginated content should not have canonical pointing to the index page. E.g. Page 2, 3, 4, should not have a canonical that points back to the index. Specifying it anyway is ambiguous and technically inaccurate.

In Shopware, we should either create a plugin on our own, or change our existing child theme plugin if we have one. To do so, we can edit this file:


And, you should add the following content:

{% block layout_head_canonical %}
  set requestedUrl = app.request.get('sw-storefront-url') ~ 

  {% if page.metaInformation.canonical && app.request.query.get('p') is not defined && requestedUrl !== page.metaInformation.canonical %}
    <link rel="canonical" href="{{ page.metaInformation.canonical }}" />
  {% endif %}
{% endblock %}

This should then override the file from the @Storefront:


This code sort of uses a "reverse logic" to include the canonical URL specification only on the pages where it was specifically defined. E.g. In page.metaInformation.canonical; if a page number was supplied (in this case in the p parameter), or if the requested URL matches the URL specified as canonical, we do not include the canonical specification in the code. E.g. We do not want a canonical that equals the requested URL, because that is just redundant.

What's wrong with Canonical on paginated content

Allowing search engines to decide for themselves how to crawl paginated content is actually quite logical and natural when you think about it, because even though you might think these pages does not have any "content" in the sense of having either text, images or video, they are not duplicate.

Even if the pages only contain a collection of text links, the link collection actually does qualify as content on those pages.

A good search engine will understand this distinction, so there is no reason to worry that having a lot of paginated content is somehow going to harm your page.

Additionally, we should get rid of redundant canonical; although they do not do any harm, having a canonical that points to to the same page is just unnecessary, and it adds to the (probably) existing clutter in the HTML.

When should canonical be used then?

Canonical should only be used to specifically tell which URL is the canonical version. E.g. If your CMS is erroneously permitting the use of unused URL parameters, or if your content is otherwise duplicated or syndicated across different URL locations.

Paginated content is not duplicate or low quality content. And to be clear, you also should not use canonical on pages that you deem to have little or "low quality" content. Allow the search engines to decide this for themselves - in any case, canonical is not the right tool to signal whether you think something is insignificant, for that you might opt to use noindex instead; but even still, you will probably be wasting your time doing so.

Tell us what you think:

  1. How to access standard php $_GET parameters from the Shopware storefront .twig files. E.g. The URL query string parameters.
  2. Sometimes we may to manually clear cached Shopware files to fix namespace issues.
  3. You need quite a few files just to create a scheduled task in Shopware, and getting it right can be a challenging undertaking to new developers. In this tutorial, I tried to simplify the process.
  4. This error can apparently happen as a result of numerous situations causing perpetual calls to functions or methods. In this article, I try to list some of them.
  5. Here is the reason why the Shopware build script may not progress beyond: Dumped plugin configuration.

More in: Shopware