pbCanonical
Сниппет для вывода мета тегов canonical
Parameters
| Parameter | Default | Description |
|---|---|---|
contexts | web | List of contexts, separated by commas |
defaultCanonical | false | Adds a tag. If true — the canonical URL always points to the default context. If false — context is included. |
defaultAlternate | true | Adds tags for other contexts. If false — skips the current context and/or default context alternates. |
If the system setting
pageblocks_context_awareis enabled, thecontextsparameter will be ignored.
Examples
Page alias: page, domain: https://site.com, defaultCanonical = false
php
{'!pbCanonical'|snippet}html
<link rel="canonical" href="https://site.com/page" />
<link rel="alternate" hreflang="en" href="https://site.com/en/page" />html
<link rel="canonical" href="https://site.com/en/page" />
<link rel="alternate" hreflang="ru" href="https://site.com/page" />Page alias: page, domain: https://site.com, defaultCanonical = true
php
{'!pbCanonical'|snippet: [
'defaultCanonical' => true
]}html
<link rel="canonical" href="https://site.com/page" />
<link rel="alternate" hreflang="en" href="https://site.com/en/page" />html
<link rel="canonical" href="https://site.com/page" />
<link rel="alternate" hreflang="ru" href="https://site.com/page" />
<link rel="alternate" hreflang="en" href="https://site.com/en/page" />