Support » Fixing WordPress » Question on Canonical To Avoid Duplicate Content with Google

  • The SomniGel Sapphier has multiple categories.

    Product: SomniGel Sapphier
    Primary: gel-infused
    Others: hybrid, latex, pocketed-spring, etc.

    The default (primary) URL is /mattresses/gel-infused/somnigel-sapphire/

    However, in testing this as an end-user, I visit the site and click mattresses (parent): /mattresses/

    Then hybrids (secondary category), the URL is now: /mattresses/hybrid/

    Then I click the Somni-gel Sapphire (product), the URL is now: /mattresses/gel-infused/somnigel-sapphire/

    As you can see, hybrid in the category URL changed to gel-infused, when we really want it to be: /mattresses/hybrid/somnigel-sapphire/

    We want to avoid Google penalizing us for duplicate content since it’s one product, yet we want both URL’s….

    Ultimately we need 2 things:

    We want to use canonical URL’s so that:

    1) the URL structure shows the correct category we select as a user: /mattresses/hybrids/somnigel-sapphire/

    2) we avoid any duplicate content with Google so it’s “masked” to the URL but in reality its one page in the background.

    Any guidance is welcome. I am also attaching the

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    WordPress normally outputs a <link rel="canonical"... link on all singular pages that tells search bots what a page’s correct permalink is no matter what the link is that they followed to get to the page. It seems to be missing on your pages. Some theme or plugin code would need to explicitly disable the output for it to not be there. You can try adding code to put it back in:
    add_action('wp_head', function() { rel_canonical();}, 32767 );

    WP displays the category hierarchy in an URL based on the first category term found assigned to the post/product. If multiple terms are assigned, it’s unpredictable what term will be used. There is a way to affect the URL output for a post/product, but how would code know what the “correct” term is to use as the hierarchy?

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.