Artesaos\SEOTools\SEOMeta::getCanonical PHP Method

getCanonical() public method

Get the canonical URL.
public getCanonical ( ) : string
return string
    public function getCanonical()
    {
        $canonical_config = $this->config->get('defaults.canonical', false);
        return $this->canonical ?: ($canonical_config === null ? app('url')->current() : $canonical_config);
    }

Usage Example

Example #1
0
 public function test_set_canonical()
 {
     $fullHeader = "<title>It's Over 9000!</title>";
     $fullHeader .= "<meta name=\"description\" content=\"For those who helped create the Genki Dama\">";
     $fullHeader .= "<link rel=\"canonical\" href=\"http://domain.com\"/>";
     $canonical = 'http://domain.com';
     $this->seoMeta->setCanonical($canonical);
     $this->setRightAssertion($fullHeader);
     $this->assertEquals($canonical, $this->seoMeta->getCanonical());
 }