AmpPagesSiteTreeExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A MetaTags() 0 8 1
1
<?php
2
namespace DorsetDigital\SilverStripeAmpPages;
3
4
use SilverStripe\CMS\Model\SiteTreeExtension;
5
use SilverStripe\View\HTML;
6
7
class AmpPagesSiteTreeExtension extends SiteTreeExtension
8
{
9
10
    public function MetaTags(&$tags)
11
    {
12
        $ampLink = $this->owner->AbsoluteLink()."amp.html";
13
        $atts = [
14
            'rel' => 'amphtml',
15
            'href' => $ampLink
16
        ];
17
        $tags .= "\n".HTML::createTag('link', $atts)."\n";
18
    }
19
}
20