• flashpacker

    (@flashpacker)


    I have the canonical plugin installed and for some reason I’m getting two tags appear in my page source code.

    This is what’s happening on the home page (static page)
    <link rel=’canonical’ href=’http://www.name.com&#8217; /> (no trailing slash)
    <link rel=”canonical” href=”http://www.name.com/”/&gt;

    The is whats happening on all other pages

    <link rel=’canonical’ href=’http://www.name.com/contact/&#8217; />
    <link rel=”canonical” href=”http://www.name.com/contact/”/&gt;

    (both with trailing slash but one with single quotes and other with double quotes).

    I am only having this occur on one site. Its not happening with my other site, which also has the plugin. That site is displaying with the trailing slash and double quotes.

    Any ideas what might be causing the missing trailing slash version/single quotes version?

    Thanks!

Viewing 1 replies (of 1 total)
  • I can’t answer why your two canonical URLs are different, but on the homepage I would guess the search engines will not be confused. On any other url, the trailing slash is potentially significant, but that doesn’t appear to be a problem here.

    Do you use Platinum SEO or All in One SEO Pack plug-ins? Probably one of those is generating the second canonical link tag. I believe you’d see comments such as:
    <!-- platinum seo pack 1.3.2 -->
    before and after the second canonical link tag; if so, that identifies the plug-in.

    WordPress 2.9.2 (possibly dating back to 2.9.0) includes a rel=canonical tag for every page for which is_single() returns true — which I think means all posts and all pages, but not the homepage, tag pages, category pages, date archives. In any case, as of the 1.3.2 version of Platinum SEO Pack plug-in, this means that all the is_single() pages will have two rel=canonical tags.

    Because the Platinum SEO plug-in creates a canonical URL for _every_ page, not just the is_single() pages, my solution was to disable the tag coming from wordpress itself. To do so, edit the functions.php file from your theme, or create one if necessary, with this line:

    remove_action( 'wp_head', 'rel_canonical');

    Note that if you are creating a new functions.php, you’ll need the file to contain the PHP tags, e.g.:


    <?php
    remove_action( 'wp_head', 'rel_canonical');
    ?>

    The same file can disable many of the unnecessary link tags in the doc header; see:
    http://wpengineer.com/wordpress-header/

Viewing 1 replies (of 1 total)
  • The topic ‘two canonical tags showing – with and without trailing slash’ is closed to new replies.