Artesaos\SEOTools\SEOTools::setCanonical PHP Method

setCanonical() public method

Sets the canonical URL.
public setCanonical ( string $url ) : Artesaos\SEOTools\Contracts\SEOTools
$url string
return Artesaos\SEOTools\Contracts\SEOTools
    public function setCanonical($url)
    {
        $this->metatags()->setCanonical($url);
        return $this;
    }

Usage Example

Beispiel #1
0
 public function test_set_canonical()
 {
     $this->seoTools->setCanonical('http://domain.com');
     $expected = "<title>It's Over 9000!</title>";
     $expected .= '<meta name="description" content="For those who helped create the Genki Dama">';
     $expected .= '<link rel="canonical" href="http://domain.com"/>';
     $expected .= '<meta property="og:title" content="Over 9000 Thousand!" />';
     $expected .= '<meta property="og:description" content="For those who helped create the Genki Dama" />';
     $this->setRightAssertion($expected);
 }