• Resolved geerthoekzema

    (@geerthoekzema)


    A website of a client of my has a few category pages and custom taxonomy archive pages. All of the archive pages are missing the trailing slash in the cannonical URL.

    I’ve fixxed this issue with:

    function wpseo_canonical_home_url_fix( $canonical_url ) {
    
        // Simply add a trailing slash if it hasn't one
        return trailingslashit( $canonical_url );
    
    }
    add_filter( 'wpseo_canonical', 'wpseo_canonical_home_url_fix' );

    Expect I’m also running WPML, and the alternate lang URL’s are also missing the trailing slash.

    As soon as I disable the Yoast plugin, all URL’s are returing back to normal. Somehow yoast is removing the trailing slash from category pages.

    I have also the ‘force the /’ option enabled (under advanced).

    It doesn’t matter if I change themes, problem still excists after change.

    https://www.ads-software.com/plugins/wordpress-seo/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor Joost de Valk

    (@joostdevalk)

    Hey Geert,

    I’m confused, category pages don’t have a canonical when our plugin isn’t active, do they?
    Also:
    – What’s your permalink setting for posts?
    – Do you have the trailing slash option under Advanced -> Permalinks set?

    Thread Starter geerthoekzema

    (@geerthoekzema)

    Hi Joost,

    You’re right that when I disable the yoast plugin, there is no cannonical. However it’s not only the cannoncical URL which is missing the ending slash. Also the link to ‘view’ the page in WordPress is missing the ending slash. Basicly WordPress is thinking there is no ending slash. Also the rel=alternate URL’s are missing the ending slash.

    With Yoast enabled: the URL i’m seeing in wordPress is without traling slash. With Yoast disabled: the URL is having a traling slash.

    About your questions:
    Permalinks are set to /%postname%/
    And I’ve enabled the traling slash option under advanced.

    Plugin Contributor Joost de Valk

    (@joostdevalk)

    Hmm that’s weird. I’m calling in the fire brigade to have a look at this ??

    Thread Starter geerthoekzema

    (@geerthoekzema)

    Important to know: the website is running on a nginx server.

    I also asked our webhoster to check the nginx rewrite rules.

    Thread Starter geerthoekzema

    (@geerthoekzema)

    @joost:
    The rewrite rules have been checked and should be OK.

    The site we are talking about is shirtlezen.nl / .be

    webpages who are not working correctly:
    – category archive: https://www.shirtlezen.nl/accessoires-bedrukken
    – Single: https://www.shirtlezen.be/bedrukken/t-shirt

    Webages which are correct:
    – page: https://www.shirtlezen.nl/accountant/
    – frontpages

    Btw:
    You’ll see that the cannonical URL is having a ending slash. That is because I’ve added this via de function mentiod in de opening post.

    Thread Starter geerthoekzema

    (@geerthoekzema)

    Any help from the fire brigade? ??

    Plugin Contributor Joost de Valk

    (@joostdevalk)

    Not yet, honestly don’t get it.

    – Single: https://www.shirtlezen.be/bedrukken/t-shirt

    that’s wrong than though? if you’ve got permalinks set to /%postname%/?

    Thread Starter geerthoekzema

    (@geerthoekzema)

    I’v expected to get the alternate lang href URL:

    <link rel="alternate" hreflang="nl-NL" href="https://www.shirtlezen.nl/bedrukken/t-shirt/" />
    <link rel="alternate" hreflang="nl-BE" href="https://www.shirtlezen.be/bedrukken/t-shirt/" />

    But instead I’m getting:

    <link rel="alternate" hreflang="nl-NL" href="https://www.shirtlezen.nl/bedrukken/t-shirt" />
    <link rel="alternate" hreflang="nl-BE" href="https://www.shirtlezen.be/bedrukken/t-shirt" />

    Not in the adressbar, but in the sourcecode.

    (edited post)

    And yes, the alternative href’s are generated by WPML and not by the yoast plugin. But also the cannonical URL is missing the ending-slash and internal adminlinks (the preview link in de wp-admin of the page) is missing the ending slash.

    As soon as I disable yoast plugin. Everything is working fine.

    Plugin Contributor Joost de Valk

    (@joostdevalk)

    Our plugin doesn’t generate those, WPML does, so you’ll need to talk to them about those hreflang ones…

    Thread Starter geerthoekzema

    (@geerthoekzema)

    Already expected you’d say that. That’s why I edited my post.

    And yes, the alternative href’s are generated by WPML and not by the yoast plugin. But also the cannonical URL is missing the ending-slash and internal adminlinks (the preview link in de wp-admin of the page) is missing the ending slash.

    As soon as I disable yoast plugin. Everything is working fine.

    Plugin Contributor Joost de Valk

    (@joostdevalk)

    Hmm well the canonical is a bug, but I’m having a hard time reproducing it which makes fixing it even harder ??

    Thread Starter geerthoekzema

    (@geerthoekzema)

    Well..

    In the end it just solved itself. I’ve reconfigured the site: deinstall the plugins, reinstall, and activate them one-by-one. It magically solved the issue ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Category slugs are missing ending slash’ is closed to new replies.