Making WordPress.org


Ignore:
Timestamp:
09/15/2020 11:49:02 PM (6 years ago)
Author:
dd32
Message:

Robots: remove some hard-coded sitemap links.

Additionally, temporarily disable the news sitemap when no published posts are present until an upstream determination is made.

See #5438.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-robots.php

    r9818 r10258  
    4040        if ( 'wordpress.org' === $blog_details->domain ) {
    4141                $robots = "Sitemap: https://wordpress.org/news/sitemap.xml\n" .
    42                           "Sitemap: https://wordpress.org/news/news-sitemap.xml\n" .
    4342                          "Sitemap: https://wordpress.org/showcase/sitemap.xml\n" .
    44                           "Sitemap: https://wordpress.org/showcase/news-sitemap.xml\n" .
    4543                          $robots;
    4644        }
     
    4947         * Add the Plugins and Theme directory Sitemaps
    5048         * Currently disabled for Rosetta as Jetpack sitemaps aren't working there.
    51          * Themes are currently disabled as there's a redirect in place breaking direct access.
    5249         */
    5350        if (
     
    6259}
    6360add_filter( 'robots_txt', 'wporg_robots_prefix_sitemaps', 1 );
     61
     62// Remove the Jetpack News sitemap when there's no news on the site.
     63// Remove once the upstream Jetpack issue is closed or merged https://meta.trac.wordpress.org/ticket/5438
     64add_filter( 'jetpack_news_sitemap_include_in_robotstxt', function( $include ) {
     65        if ( $include && empty( wp_count_posts()->publish ) ) {
     66                $include = false;
     67        }
     68
     69        return $include;
     70} );
Note: See TracChangeset for help on using the changeset viewer.