• Resolved David Mondok

    (@davidmondok)


    Currently, there’s no setting to remove the /login-designer page from the sitemap generated by Yoast. When trying to edit the page itself I’m getting redirected to Customizer automatically so I don’t have access to the Yoast settings for that page. I removed the page via a Yoast hook but I guess it would be good to do this automatically as there shouldn’t ever be a need for that site to be in the sitemap.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey David, the page really shouldn’t be showing up there – as it’s opting out at the template/page level. Here’s where that’s happening in the code.

    Any ideas on this?

    • This reply was modified 5 years, 1 month ago by Rich Tabor.
    Thread Starter David Mondok

    (@davidmondok)

    Hey Rich,

    adding <meta name="robots" content="noindex, nofollow" /> is definitely a great and absolutely necessary precaution to reduce the chance of having that page indexed by search engines. I’m specifically choosing the word “reduce” and not “eliminate” as we have experienced cases of pages being indexed despite the meta tag being correctly set. That’s the reason why we think it would be a good addition to remove the login-page from the sitemap as well. Just as another precaution.

    I haven’t looked into it in detail but from the top of my head, I can’t think of a non-plugin-specific approach to tackle this problem.

    I guess one would have to hook into plugin specific filters to remove the page from the sitemap.

    For Yoast the code would be

    add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', function () {
        // replace 1 with login-page post ID
        return array( 1 );
    } );

    Here’s the Yoast documentation

    For Rank Math this would be a starting point

    add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ) {
    	// if login page return null
    
    	return $url;
    }, 10, 3 );

    Here’s the Rank Math documentation

    Thanks @davidmondok – I’ll get those on the road map. Appreciate it!

    Hey @davidmondok – I added the filters to this version of the plugin here (https://www.dropbox.com/s/k5nn7yfmpwe891s/login-designer.zip?dl=0). Want to give that a try and see if it does the trick for you?

    Rich Tabor

    (@richtabor)

    Hey David, I just released a version with this addition – as well as support for WordPress 5.3. Thanks for your feedback!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove /login-designer from Yoast sitemap’ is closed to new replies.