Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does canonical require "link rel=" format instead of "meta"? #20

Open
rickross opened this issue Jul 27, 2015 · 1 comment
Open

Does canonical require "link rel=" format instead of "meta"? #20

rickross opened this issue Jul 27, 2015 · 1 comment

Comments

@rickross
Copy link

I was not getting the "meta name=canonical" tag to be recognized by a popular SEO extension I use, so I located the part of the MarkupSEO module that emits and made a simple change around line 340 in MarkupSEO.module:

    // add "render"
    $rendered = '';
    foreach($pageData as $name => $content) {
        if($name == 'custom') { 
            continue; 
        }
        if($name == 'title') {
            if($this->titleFormat == '') continue;
            $rendered .= '<title>'.$this->parseTitle($page, $content).'</title>'.PHP_EOL; 
            continue;
        }
        if($name == 'canonical') {
            $rendered .= '<link rel="canonical" href="'.$content.'">'.PHP_EOL; 
            continue;
        }
        $rendered .= '<meta name="'.$name.'" content="'.$content.'">'.PHP_EOL;
    }

Now the canonical reference is correctly recognized by the SEO checker I was using.

@nicoknoll
Copy link
Owner

Looks good to me. I'll implement it in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants