Prints the canonical address of the page that search engines should link to.
Kuvaus
The tag prints the address relative to the online store's root address (e.g. /product/5/hat). To add the domain to the address, use the {ShopURL}
tag.
The tag is mostly used in the <link>
element's href
attribute.
<link rel="canonical" href="{ShopUrl}{CanonicalURL}" />
This prevents search engines from indexing the same product more than once by using different addresses (e.g. /product/5/hat ja /product/5).
You can also use the {CanonicalURL}
tag to prevent search engines from indexing e.g. development versions (development.store.mycashflow.fi):
<link rel="canonical" href="https://www.storeaddress.fi{CanonicalURL}" />
Syntaksi
{CanonicalURL(
version: int
)}
Näkyvyys
Toimii näkyvyydessä: globaali
Tags with global scope can be used on any template and in any tag.
Defining language data in multilingual online stores
For each page in a multilingual online store, you may want to add data about the page's existing language versions as well as the page's language to its <head>
section. You can do it by using the {CanonicalURL}
tag's version
attribute:
<head>
{CanonicalUrl(version: 1, before: '<link rel="alternate" href="https://www.example.com', after: '" hreflang="en" />')}
{CanonicalUrl(version: 2, before: '<link rel="alternate" href="https://fi.example.com', after: '" hreflang="fi-fi" />')}
{CanonicalUrl(version: 3, before: '<link rel="alternate" href="https://www.example.de', after: '" hreflang="de-de" />')}
{CanonicalUrl(version: 4, before: '<link rel="alternate" href="https://www.example.fr', after: '" hreflang="fr" />')}
{CanonicalUrl(version: 5, before: '<link rel="alternate" href="https://www.example.com', after: '" hreflang="x-default" />')}
...
Note that, for each link, the language is defined in the link element's hreflang attribute.
Attribuutit
version:
Defines the version whose address should be printed.
Sallitut arvot: Version ID-numero. Esim.version:
3after/before:
By using the
after
andbefore
attributes you can define content that is output either after or before the tag's output.Allowed values:HTML and Interface markup.
E.g.
before:
'<p>Tämä merkkaus näkyy ennen tagin omaa sisältöä.</p>'after:
'<p>Tämä taas näkyy tagin oman sisällön jälkeen.</p>'
If the tag does not produce any content, neither the content of the
after
andbefore
attributes will be output.escape:
Adds an escape character before quotation marks in the output.
The attribute makes it easier to process the tag-produced content when using JavaScript.
Allowed values:true/false. The default value is false.
or:
Defines alternative content that is displayed if the tag itself does not produce any content.
Allowed values:HTML and Interface markup.
E.g.
or:
'Sisältöä ei löytynyt.'