Cannot set canonical url on collection page with "limit=" parameter

New Member
2 0 0

I have a problem with setting canonical url on collection page with "?limit=" parameter (for example here).
It is set wrongly by default and does not contain https://.

For all other "parameter" pages (like color, price etc.) it is working properly, the problem is only with this specific one.
If there is "limit" parameter and more other parameters it works properly too (for example here).

I try to set custom canonical url in head like below but it does not work for some reason for this one particular page.
Condition is for 100% set properly because every code placed there is executed except this canonical link.
The value of canonicalWithHttps is also proper, with https:// and proper url.

Can you tell me what is going on with this one specific page?



{% assign exceptionElements = "/color-, /color:, +color:, +color-, /price-, /price:, +price:, +price-, /brand-, /brand:, +brand:, +brand-, limit=, " | split: ", " %}
{% assign canonicalUrl = pageUrl | split: '?' | first %}

{% for exception in exceptionElements %}
      {% if ... %} option 1 - working properly
      {% elsif pageUrl contains 'limit=' %}
           {% assign canonicalWithHttps = 'https://' | append: canonicalUrl %}
           <link rel="canonical" href="{{ canonicalWithHttps }}"/>
           {% break %}
       {% elsif ... %} options working properly
       {% endif %}
{% endfor %}