How to auto add Canonical URL in advantage tab ?

#470984
  • Resolved Robert-D
    Rank Math free

    i have 2 url like as:
    1) myhomepage/myslugpost/
    2) myhomepage/myslugpost/feed
    it’s the same content as duplicate, i would inform to google index myhomepage/myslugpost/
    now many url was situation as above.
    i tried to add filter of rank math plugin to fill auto canonical Url in advantage tab as code below:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
    $canonical = get_permalink();
    return $canonical;
    });

    seemly it not working. when edit the post it not working. or make new post it’s not auto fill canonical according to permalink slug .

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

    Thank you for contacting Rank Math support, and sorry for any inconvenience that might have been caused due to that.

    The canonical URL for the post is already configured correctly and you don’t have to add one for your feed since this isn’t supposed to be crawled by the search engines. Rank Math should add the canonical tags for you.

    You can add a rule in your robots.txt so Google won’t be indexing it.

    User-Agent: *
    Disallow: */feed/

    Hope that helps.

    Thanks Alot bro !

    Hello,

    We are super happy that we could address your concern.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

You must be logged in to reply to this ticket.