[Support request] Placing a canonical tag

Home Forums Support Placing a canonical tag

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #293281
    Michiel

    Hi Tom,

    I want to show a blog post which is part of website 1, a service oriented website, on my other website, website 2. Website 2 is a pure blog-site where I installed the masonry option. Both websites have GP + GP premium.

    I tried to link the blog post with a 301 redirection plugin, that works, but I am not totally happy with this solution as the URL changes so the visitor leaves the site.

    Now I am thinking to copy the blog post from one site to the other. In that case I duplicate the content and I need to place a canonical tag. My question is: where in the blogpost should I put this tag?

    (If you know another way to show a blog post on my other website please let me me know)

    By the way, still very happy with GP!

    Thx
    Michael

    GeneratePress 1.3.46
    #293400
    Leo
    Staff
    Customer Support

    Hi Michael,

    Sorry I’m missing something but maybe you can insert the link to your other website like this so it opens up in a new tab?
    <a href="https://URL-HERE" target="_blank">Blog Title</a>

    Let me know if this helps.

    #293416
    Michiel

    Thank you Leo.

    Please take a look at website 2, the blog-site. It is: derden.org.

    You will see two blog post at the right hand corner:
    – test, this is the blog post where I have added a link. Please click on the post.
    – als u een organisatieadviseur uitnodigt etc: this post is redirected with a 301 redirection plugin. The visitor moves to website 1, which a don’t like.

    Therefore I was thinking to duplicate content of a blog from website 1 to website 2, but duplication is from a SEO point of view not recommendable. Experts say that you can prevent SEO-problems by putting a “canonical tag” between the head tags. But I do not know how to do that. Where do I find the “head” tags of a blogpost?

    Thx

    #293455
    Tom
    Lead Developer
    Lead Developer

    You would have to use the wp_head hook in GP Hooks.

    However, it would need to be inside a conditional so it only displays for that page.

    For example:

    <?php if ( is_single( 'your-post-slug' ) ) { ?>
        Canonical tag for yoursite.com/your-post-slug here
    <?php } ?>

    Let me know if that helps or not 🙂

    #293772
    Michiel

    Thank you Tom, working with hooks is new for me and feels a bit tricky. I installed hooks and found GP-head.
    I assume if I make a mistake it will be easy to correct. Just to be sure could you please evaluate the following:

    Q1: what to use in the first part: ‘your-post-slug’ or your-post-slug (with or without quotes?)
    Q2: is this the right canonical tag: <link rel=”canonical” href=”http://yoursite1.com/your-post-slug.html” />
    Q3: if I want to do the same operation for another post, can I just add one more line to WP-heads?

    So I am thinking to add the following to GP-heads:
    <?php if ( is_single( ‘your-post-slug’ ) ) { ?>
    <link rel=”canonical” href=”http://yoursite 1.com/your-post-slug.html” /><?php } ?>

    Thx

    #293794
    Michiel

    to add another q: please evaluate when to use a single quote (‘) and when to use double quotes (“).

    #293812
    Leo
    Staff
    Customer Support

    Hi there,

    1. You would need to replace that with the actual post slug: http://www.wpbeginner.com/glossary/post-slug/.
    Keep the quotation.

    2. Looks right. but you would need to replace “http://yoursite1.com/your-post-slug.html&#8221; to the actual link to your post.

    3. I assume you would need to link to a different post? If so then yes.

    #315081
    v4ncouver

    Could you please provide an example of what to paste in the wp-head field if we want to add a canonical tag to landing pages?
    Example:
    Landing page 1 is for facebook
    Landing page 2 is for kijiji

    Both of the above pages are exactly the same as an already existing page that is part of the main website and to which the 2 above pages would point that tag to.

    Thanks! 🙂

    #315167
    Tom
    Lead Developer
    Lead Developer

    WordPress adds the canonical tag for you based on your page structure.

    However, if you’re using Yoast SEO, they have a field where you can add a custom URL: https://kb.yoast.com/kb/canonical-urls-in-wordpress-seo/

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.