private function getCanonicalLink(): ?string {
        $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();
    }
private function getCanonicalLink(): ?string {
        $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();
    }
private function getCanonicalLink ( ) : ? string { $ 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 ( ) ; }
If the article has meta canonical link set in the url

@return string|null
If the article has meta canonical link set in the url