Support » Plugin: Yoast SEO » Sitemaps does not work, just empty lists

  • Resolved jaxwtf

    (@jaxwtf)


    I have several pages but page-sitemap.xml only has the the home page in the list. I added the recommended nginx config but still no luck. I started to dig into the code and what I can understand, the wp action is not added at all.

    In class-sitemaps.php I found out that output will be generates by do a specific action that is named wpseo_xsl_*. So I found out that the actions is created on line 182 by this:
    add_action( ‘wpseo_xsl_’ . $name, $function );

    The function with this row is called register_xsl but I cant find its called at all in anyway in the code. I looked after the hook which an action is calling by printing all hooks just before calling the action on line 416:
    print_r($GLOBALS[‘wp_filter’]);

    There is no wpseo_xsl_* registered at all!

    So my question is, why is the sitemaps empty? It seems there is no actions added for it.

    WP: 5.3
    Yoast: 12.5

Viewing 4 replies - 1 through 4 (of 4 total)
  • I found the problem! It turns out Yoast sitemaps exlcudes pages that does not have same domain as WordPress. This is major issue since we’re using WP as a headless CMS. What is best practice here?

    WP has domain cms.domain.com
    The PWA has only domain.com

    Code that excludes this in class-post-type-sitemaps-provider.php:631:
    if ( $this->get_classifier()->classify( $url[‘loc’] ) === WPSEO_Link::TYPE_EXTERNAL ) {
    return false;
    }

    Saša

    (@stodorovic)

    Yoast SEO removes external URLs from sitemaps (if they don’t contain home_url in URL). There is possible to set different URLs for home (domain.com) and site (cms.domain.com) URLs.

    Other possible solutions are various hacking. Maybe you can use the code from https://github.com/Yoast/wordpress-seo/issues/9634

    I think this should be a setting so you can change this by yourself.

    Saša

    (@stodorovic)

    I think that’s impossible to use a permalink which doesn’t contain home_url via WP dashboard. So, I’m not sure that it should be as a setting, but maybe it’s possible to add filter which customize URL classifier. Anyway, you should create new feature request on Github if you want to Yoast implements something like this in the future.

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