mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT #6828 (Trac): Add a canonical link tag to the meta tags of Virtual Pages
See http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394
This commit is contained in:
parent
e96d6f5bd5
commit
10c171f1bb
@ -97,6 +97,21 @@ class VirtualPage extends Page {
|
|||||||
return $this->CopyContentFrom();
|
return $this->CopyContentFrom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For VirtualPage, add a canonical link tag linking to the original page
|
||||||
|
* See TRAC #6828 & http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394
|
||||||
|
*
|
||||||
|
* @param boolean $includeTitle Show default <title>-tag, set to false for custom templating
|
||||||
|
* @return string The XHTML metatags
|
||||||
|
*/
|
||||||
|
public function MetaTags($includeTitle = true) {
|
||||||
|
$tags = parent::MetaTags($includeTitle);
|
||||||
|
if ($this->CopyContentFrom()->ID) {
|
||||||
|
$tags .= "<link rel=\"canonical\" href=\"{$this->CopyContentFrom()->Link()}\" />\n";
|
||||||
|
}
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
|
|
||||||
function allowedChildren() {
|
function allowedChildren() {
|
||||||
if($this->CopyContentFrom()) {
|
if($this->CopyContentFrom()) {
|
||||||
return $this->CopyContentFrom()->allowedChildren();
|
return $this->CopyContentFrom()->allowedChildren();
|
||||||
|
Loading…
Reference in New Issue
Block a user