Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 800 forks source link

Sitemaps: add filter that allows activation of only news or only regular sitemap #8433

Open richardmtl opened 6 years ago

richardmtl commented 6 years ago

If this exists already, then forgive me, but I wasn't able to find it here: https://developer.jetpack.com/module/sitemaps/

Requested in 871801-zen , the ability to have ONLY the news sitemap generated by Jetpack, and not the Images sitemap. This would allow Yoast to generate the regular sitemap.

serambca commented 6 years ago

I think the only solution is block sitemap.xml with robots.txt.

What do you think?

jeherve commented 6 years ago

@serambca I am not sure that would be a great solution, as the sitemap links would still all be there in the index. I would recommend against it.

serambca commented 6 years ago

Hi!

The problem is that with jetpack I can’t disable a index images, sub pages , and so on.

With Yoast SEO Premium I can personalize all.

I only need a news-sitemap.xml creation because Yoast SEO need another plugin for it.

Thanks and regards

jeherve commented 6 years ago

Let's try to address those questions via email, it's probably a better place to discuss these issues that are not directly related to the problem highlighted in this issue.

serambca commented 6 years ago

I only suggest the posibbilty to filter the options that the people need.

I only need to enable sitemap-news.xml

Thanks

stale[bot] commented 6 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

stale[bot] commented 5 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

BrookeDot commented 5 years ago

Can this be closed with the addition of the jetpack_news_sitemap_generate filter? https://developer.jetpack.com/hooks/jetpack_news_sitemap_generate/

jeherve commented 5 years ago

Not quite, unfortunately, as ideally we'd want the sitemap to not be generated at all.

stale[bot] commented 4 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

BrookeDot commented 6 months ago

This request has come up a few times over the past month from WPVIP customers. Often the customer is using a sitemap solution such as MSM Sitemaps, an enterprise grade sitemap tool that has made the decision not to support news sitemaps . This leads to the customer wanting to use Jetpack's News Sitemaps alongside MSM sitemaps.

Adding a filter to allow this to happen would be ideal to the current solution of unregistering Jetpack's sitemaps based on URL. Ie:

/**
 * Remove Jetpack's sitemap feature so MSM sitemaps can take control.
 * Unless we are trying to access the news sitemap, in which case we use JP.
 */
add_action( 'init', function() {
  if ( ! class_exists( 'Jetpack_Sitemap_Manager' ) ) {
    return;
  }
  $raw_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
  if ( false === strpos( $raw_uri, '/news-sitemap.xml' ) && false === strpos( $raw_uri, '/news-sitemap.xsl' ) ) {
    vip_remove_class_filter( 'wp_loaded', 'Jetpack_Sitemap_Manager', 'callback_action_catch_sitemap_urls', 10 );
  }
}, 5 ); // Priority 5 ensures this runs before JP's hook is executed on 10.

This requires filtering the entire class (ie in this example the vip_remove_class_filter uses this gist) which is suboptimal.

github-actions[bot] commented 6 months ago

Support References

This comment is automatically generated. Please do not edit it.