Issue: There may be an issue with how the canonical tags are being generated for all pages. It appears that the canonical tag is mistakenly pointing to a URL that includes the domain name twice (screenshot below of the homepage’s canonical).
I located this in the theme.liquid but i can’t make sense of it. What do i need to do to correct so that my canonical url doesn’t list my domain 2x?
{%- if collection.url -%}
{%- assign canonicalurl = canonical_url | split: ‘/’ -%}
{%- assign updated_canonical = shop.url | append: ‘/’ | append: canonicalurl[3] | append: ‘/’ -%}
{%- assign vendor = canonicalurl[4] | split: ‘vendor’ -%}
{%- assign vendor_value = vendor[1] | split: ‘=’ -%}
{%- if vendor[1] -%}
{%- assign updated_canonical = updated_canonical | append: vendor_value[1] -%}
{%- else -%}
{%- assign updated_canonical = updated_canonical | append: canonicalurl[4] -%}
{% endif %}
{%- else -%}
{%- endif -%}
