• Resolved tinzion

    (@tinzion)


    Hi I’m using SEO Framework and I have a problem with the replytocom url do you have any solution for this?

    I already add

    ‘Disallow: *?replytocom’

    to my robots.txt but not success

    Please help me

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter tinzion

    (@tinzion)

    how can I set nofollow on this replytocom page?

    Plugin Author Sybre Waaijer

    (@cybr)

    Hello again! ??

    The ?replytocom endpoint has its canonical URL pointed to the original post’s page. So, that page shouldn’t get indexed with the replytocom query argument.

    When a search engine lands on the replytocom page, they’ll follow the canonical URL to the original page and honor the robots-tags set there, instead.

    Moreover, WordPress automatically adds “nofollow” to the link that leads to the replytocom page.

    All in all, there’s little you have to do, even the robots.txt entry is redundant ??

    So, I’d like to ask you, what’s the issue you’re experiencing with the replytocom query? I couldn’t find it in Google, as shown in the attached image below.

    replytocom site search not found

    Thread Starter tinzion

    (@tinzion)

    Hi Sybre

    but have https://alpharockcapital.com/money-management/?replytocom=2

    <meta name=”robots” content=”noindex,follow”>

    on it how can in nofollow it?

    I’m using SEO tool and scan it and it said

    ##

    Off-page canonical link on non-indexable page
    30
    Page contains robot directives preventing indexing and a canonical link pointing to another page.

    META ROBOTS #1
    max-snippet:-1,max-image-preview:standard,max-video-preview:-1
    META ROBOTS #2
    noindex,follow
    Pages with robots directives preventing indexing should not contain a canonical link pointing to another page

    ##

    how can I resolve I believe you have a solution for this

    Thank you

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi tinzion,

    My apologies for the belated reply. Had a busy server-sided weekend ??

    I now see the tag. It’s not from The SEO Framework; but, from WordPress itself. I wasn’t aware this was added to Core.

    Here’s the source: https://github.com/WordPress/WordPress/blob/f834e179019627f6faa9d807fbe038c28aee253f/wp-includes/default-filters.php#L307-L309

    To replace it with “noindex,nofollow”, you should add this to your theme’s functions.php file or a custom plugin:

    if ( isset( $_GET['replytocom'] ) ) {
    	remove_action( 'wp_head', 'wp_no_robots' );
    	add_action( 'wp_head', function() {
    		echo "<meta name='robots' content='noindex,nofollow' />\n";
    	} );
    }

    However, my first reply still holds up: robots won’t consider crawling the page, and if they do, they won’t follow its links–rendering this change futile.

    Thread Starter tinzion

    (@tinzion)

    is it because of “Disallow /*?” on my robots.txt? or can I remove these meta robots? or can I change the canonical link to itself or even remove it? since my SEO Tool said, “Pages with robots directives preventing indexing should not contain a canonical link pointing to another page.”

    • This reply was modified 4 years, 9 months ago by tinzion.
    • This reply was modified 4 years, 9 months ago by tinzion.
    • This reply was modified 4 years, 9 months ago by tinzion.
    Plugin Author Sybre Waaijer

    (@cybr)

    Hi again!

    The robots.txt file can prevent crawlers from accessing a page altogether. But, when your page contains a descriptive link to the page, then robots can still index them (although not necessarily crawl and process them). See https://support.google.com/webmasters/answer/6062608.

    It is why we urge not altering the robots.txt file further from what TSF outputs–it’s not entirely futile, but it prevents you from directing the search engine any further.

    Whereas a robots-header-or metatag allows the crawler to access the page, but it directs them to prevent indexing, following, or archiving a page completely. A “noindex” robots-header-or metatag can, therefore, remove those ?replytocom pages from search engine indexes–much like a canonical URL could.

    The SEO tool is somewhat correct in its assessment, since removing the canonical URL speeds up the directive. We have mechanisms in The SEO Framework to prevent having a canonical URL and the noindex directive being outputted alongside each other. However, conditions apply. You can read further up on this here: https://github.com/sybrew/the-seo-framework/issues/370. The description in our code reads: “If the page should not be indexed, and the permalink matches the canonical URL, empty [the canonical URL].”–this condition is never the case with ?replytocom queries.

    I hope this helps ?? Cheers!

    • This reply was modified 4 years, 9 months ago by Sybre Waaijer. Reason: clarity
    Thread Starter tinzion

    (@tinzion)

    Hi Syrbe

    I follow your instruction but I got critical error when I paste this code on my functions.php

    // PHP7+ pseudo code
    if ( ( $this->robots_meta()[‘noindex’] ?? ” ) === ‘noindex’
    && $this->get_current_canonical_url() === $this->get_current_permalink()
    )
    $canonical_url = ”;

    is there something wrong with this code?

    Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    It’s “pseudo” code–it’s not applicable real-world code, so that’s why it caused an error.

    I’m not sure why you wanted to implement that, though. Its feature was implemented in TSF 3.2.4 already. Moreover, it doesn’t apply to the ?replytocom pages, for the conditions that apply, which I explained in my previous reply.

    Now, I recommend leaving the output as-is and ignore the message displayed by the “SEO tool” you used. In your scenario, the issue doesn’t affect your site (nor Google’s behavior) at all.

    Thread Starter tinzion

    (@tinzion)

    Ok Thank you very much Sybre

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to prevent contain a canonical link pointing to another page’ is closed to new replies.