WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Canonical error on homepage (13 posts)

  1. albertosanchezm
    Member
    Posted 3 years ago #

    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

  2. albertosanchezm
    Member
    Posted 3 years ago #

    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.

  3. General
    Member
    Posted 3 years ago #

    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!!

  4. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    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?

  5. General
    Member
    Posted 3 years ago #

    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?

  6. jpilantrose
    Member
    Posted 3 years ago #

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

  7. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    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?

  8. General
    Member
    Posted 3 years ago #

    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 !!

  9. abelq
    Member
    Posted 3 years ago #

    @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

  10. petergus
    Member
    Posted 2 years ago #

    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~!

  11. petergus
    Member
    Posted 2 years ago #

    subscribe...

  12. ideafaktory
    Member
    Posted 2 years ago #

    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

  13. ideafaktory
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic