Goose\Modules\Extractors\MetaExtractor::getCanonicalLink PHP Method

    private function getCanonicalLink()
    {
        $nodes = $this->getNodesByLowercasePropertyValue($this->article()->getDoc(), 'link', 'rel', 'canonical');
        if ($nodes->count()) {
            return trim($nodes->first()->attr('href'));
        }
        $nodes = $this->getNodesByLowercasePropertyValue($this->article()->getDoc(), 'meta', 'property', 'og:url');
        if ($nodes->count()) {
            return trim($nodes->first()->attr('content'));
        }
        $nodes = $this->getNodesByLowercasePropertyValue($this->article()->getDoc(), 'meta', 'name', 'twitter:url');
        if ($nodes->count()) {
            return trim($nodes->first()->attr('content'));
        }
        return $this->article()->getFinalUrl();
    }