How to add Canonical Tag to an block element?

#1090429
  • Resolved Xi Yang
    Rank Math free

    Hello,

    I met an issue of “Duplicate without user-selected canonical” with Google Search Console.

    This result appears on one of my “No Search Result” pages. However, in my WordPress site, there isn’t a dedicated search page for “No Result Found.” So how can I add a canonical tag to this page? Alternatively, if I plan to use GenerateBlocks to create a new block element, how can I add a canonical tag to that block element?

    I know that I can add canonical tags to Posts or Pages simply by using the Rank Math SEO options on the page, but I noticed that on the element pages, there is no Rank Math SEO option available.

    Please take a look at my screenshot: https://postimg.cc/gallery/ppGQQCt

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    We apologize for the issue you are facing with the "Duplicate without user-selected canonical" status in Google Search Console. To address this, you can add a canonical tag to your "No Search Result" page by following these steps:

    1. Using Rank Math for Pages: If you want to set a canonical URL for a specific page (like your "No Result Found" page), you can do this by editing the page in WordPress. In the Rank Math meta box, which is usually found below the post editor, you can set the canonical URL under the Advanced tab. If you don’t see this option, ensure that you have enabled Advanced Mode in Rank Math.

      • To enable Advanced Mode, go to WordPress Dashboard → Rank Math SEO and toggle it on.

      Enable Advanced Mode

      Once in Advanced Mode, you can enter your desired canonical URL in the Canonical URL field.

    2. For Block Elements: If you are using GenerateBlocks and want to add a canonical tag to a block element, you will need to add the canonical tag manually in the HTML of your theme or through a custom function. Unfortunately, Rank Math does not provide a direct option for adding canonical tags to individual block elements. You can add the following code snippet to your theme’s header.php file or use a custom plugin:

      Replace `https://rankmath.com/wp-content/uploads/2023/01/advanced-mode-8-scaled.jpg with the actual URL you want to set as canonical.

    3. Using Custom Code: If you’re comfortable with coding, you can also use a hook in your theme’s functions.php file to dynamically add canonical tags based on conditions.

    If you still have questions or need further assistance, please reply to this ticket, and a human agent from our support team will be happy to help you further! Thank you for raising this concern.

    Sources:
    How to Fix ‘Duplicate Without User-Selected Canonical’ Status in Google Search Console » Rank Math
    How to Fix ‘Duplicate Without User-Selected Canonical’ Status in Google Search Console » Rank Math

    Xi Yang
    Rank Math free

    I need human support

    Hello,

    Your internal search results page shouldn’t be indexed, as we explained here:
    https://rankmath.com/kb/internal-site-search-spam/

    Also, canonical tags can only be added to HTML web pages, and not in those blocks or elements.

    Looking forward to helping you.

    Xi Yang
    Rank Math free

    Hello Reinelle,

    Thank you for your answer and link. I understand it right now.

    Hello,

    Glad that helped.

    If you have any other concerns, please don’t hesitate to contact us anytime so we can assist you further.

    Looking forward to helping you.

Viewing 5 replies - 1 through 5 (of 5 total)

The ticket ‘How to add Canonical Tag to an block element?’ is closed to new replies.