@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public function updateCMSFields(FieldList $fields) { |
| 17 | 17 | |
| 18 | 18 | $CanonicalDomainField = TextField::create('CanonicalDomain') |
| 19 | - ->setDescription(_t(__CLASS__ . '.InfoField', 'The canonical domain will be added to the HTML head. It can be overriden per Page in ') . _t('SilverStripe\CMS\Model\SiteTree.MetadataToggle','Metadata') . '.') |
|
| 19 | + ->setDescription(_t(__CLASS__ . '.InfoField', 'The canonical domain will be added to the HTML head. It can be overriden per Page in ') . _t('SilverStripe\CMS\Model\SiteTree.MetadataToggle', 'Metadata') . '.') |
|
| 20 | 20 | ->setAttribute('placeholder', _t(__CLASS__ . '.CanonicalDomainDescription', 'https://www.example.com')); |
| 21 | 21 | |
| 22 | 22 | $fields->addFieldToTab('Root.Canonical', $CanonicalDomainField); |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | public function updateCMSFields(FieldList $fields) { |
| 18 | 18 | if ($MetaToggle = $fields->fieldByName('Root.Main.Metadata')) { |
| 19 | 19 | if ($url = $this->getorsetCanonicalURL()) { |
| 20 | - $MetaToggle->push($MetaCanonical = TextField::create('CanonicalURL', _t(__CLASS__ . '.LinkOverride',"Override canonical URL"))); |
|
| 20 | + $MetaToggle->push($MetaCanonical = TextField::create('CanonicalURL', _t(__CLASS__ . '.LinkOverride', "Override canonical URL"))); |
|
| 21 | 21 | $MetaCanonical |
| 22 | 22 | ->setAttribute('placeholder', $this->getorsetCanonicalURL()) |
| 23 | - ->setDescription(_t(__CLASS__ . '.LinkOverrideDesc','Only set this if another URL should count as the original (e.g. of reposting a blog post from another source).')); |
|
| 23 | + ->setDescription(_t(__CLASS__ . '.LinkOverrideDesc', 'Only set this if another URL should count as the original (e.g. of reposting a blog post from another source).')); |
|
| 24 | 24 | } else { |
| 25 | - $MetaToggle->push($MetaCanonical = LiteralField::create("CanonicalURL", '<p class="form__field-label">' . _t(__CLASS__ . '.LinkFieldPlaceholder','Canonical-URLs needs a Canoinical-Domain in <a href="/admin/settings">SiteConfig</a>') . '</p>')); |
|
| 25 | + $MetaToggle->push($MetaCanonical = LiteralField::create("CanonicalURL", '<p class="form__field-label">' . _t(__CLASS__ . '.LinkFieldPlaceholder', 'Canonical-URLs needs a Canoinical-Domain in <a href="/admin/settings">SiteConfig</a>') . '</p>')); |
|
| 26 | 26 | } |
| 27 | - $MetaCanonical->setRightTitle(_t(__CLASS__ . '.LinkFieldRightTitle','Used to identify the original resource (URL) to prevent being considered as "duplicate content".')); |
|
| 27 | + $MetaCanonical->setRightTitle(_t(__CLASS__ . '.LinkFieldRightTitle', 'Used to identify the original resource (URL) to prevent being considered as "duplicate content".')); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | // add canonicalBase if relative URL |
| 47 | 47 | if (isset($link)) { |
| 48 | 48 | $urlArray = parse_url($link); |
| 49 | - if (!isset($urlArray['host']) && !isset($urlArray['scheme'])) { |
|
| 50 | - $canonicalBase = $urlArray['scheme'] . '://' . $urlArray['host']; |
|
| 49 | + if (!isset($urlArray[ 'host' ]) && !isset($urlArray[ 'scheme' ])) { |
|
| 50 | + $canonicalBase = $urlArray[ 'scheme' ] . '://' . $urlArray[ 'host' ]; |
|
| 51 | 51 | $link = $canonicalBase . $link; |
| 52 | 52 | } |
| 53 | 53 | } else { |