Support » Plugin: Yoast SEO » [Plugin: WordPress SEO by Yoast] Canonical error on homepage

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi again,

    I have commented the line that assigns the $canonical value for the home page on the frontpage class as a temporal solution. Y prefer to have nothing in the home rather than a wrong canonical value.

    Anyway, any help for identify the problem is welcomed.

    Hello all,

    I have a problem with the canonical tag. In my blog http://www.plasticosydecibelios.com all the canonical works fine except in the home, that is pointing to http://www.plasticosydecibelios.com/page/1/

    Any idea how to fix it?

    Thanks in advanced

    i have the same problem
    please anyone help us!!

    Plugin Author Joost de Valk

    (@joostdevalk)

    To be honest this can only be caused by weirdness in your theme, not in the plugin. Is your theme resetting the WP query in any way?

    I’ve solved the problem by modifying class-frontend.php file in frontend folder and so by modifying the following code:

    if ( !empty($canonical) ) {
    if ( $echo )
    echo "\t".'<link rel="canonical" href="'.$canonical.'" />'."\n";
    else
    return $canonical;
    }

    to this code

    if ( !empty($canonical) ) {
    if ( is_home() || is_front_page() ) { echo "\t".'<link rel="canonical" href="'.get_bloginfo('url').'/'.'" />'."\n"; }
    else if ( $echo )
    echo "\t".'<link rel="canonical" href="'.$canonical.'" />'."\n";
    else
    return $canonical;
    }

    Is this Modified is true, or is there another solution?

    This fix worked for me. Thank you General for posting this.

    Plugin Author Joost de Valk

    (@joostdevalk)

    General, I’m very curious to know why that works for you… Must be either a weird bug in my code or something very specific in your setup, could you give me access to that site, perhaps?

    that is my website kollity

    and I also have modify the “class-opengraph.php” file in “frontend” folder
    by changing the following code:

    public function url() {
    		$url = WPSEO_Frontend::canonical( false );
    		echo "\t<meta property='og:url' content='".esc_attr( $url )."'/>\n";
    	}

    to this code:

    public function url() {
    		if ( is_home() || is_front_page() ) { $url = get_bloginfo('url').'/'; }
    		else
    		$url = WPSEO_Frontend::canonical( false );
    		echo "\t<meta property='og:url' content='".esc_attr( $url )."'/>\n";
    	}

    i hope you tell me why this happen with me !!

    @joostdevalk

    This also happened to me. Homepage having a canonical of http://domain.com/page/1/ using Intrepidity theme.

    Upon inspecting the theme files, I found out that it was using the home.php for it’s homepage template that overrides index.php.

    I removed it for now and the canonical of the front page is back to http://domain.com/ again.

    Thanks for this plugin. It has my vote as the best SEO plugin coz it does so much more.

    Cheers!
    Abel

    General’s 2 fixes worked for me.
    however should it really look like this .com/" /> (with the slash after .com?)

    will these fixes be patched into an update @yoast? wouldnt want to lose them in any further updates.

    thanks~!

    subscribe…

    Hi, I am having the same issue with my web site. I really like the Yoast plugin, but ever since installing it, when anyone tries to share my homepage (http://ideafaktory.com) on a social site, it redirects to a specific post (http://www.ideafaktory.com/mobile/how-microsoft-can-beat-google-android-apple-iphone/). This happens with Facebook, Sharethis, and Hootsuite. I am reluctant to apply the above fix until I know that’s the problem and get a more guided response.

    Would really appreciate your help with a step-by-step resolution! This has been a really frustrating bug. Thanks!

    PS – Here is the info from the facebook debugger that shows the problem (some kind of canonical redirect error). Unfortunately I am a novice at site coding, so this beyond my ability. https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fideafaktory.com

    Follow-up to my prior post. I found the problem. It was not the Yoast SEO plugin. It was the wrong data in the Facebook OpenGraph plugin, which I deleted and all works fine.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] Canonical error on homepage’ is closed to new replies.