Removing a CPT from the sitemap but leaving the CPT Archive page in the sitemap does not work #11391
Comments
Shouldn't we just hide/remove the settings for the CPTs archive when the CPT is set to not show in search results, @jdevalk? |
@tacoverdo I'm not sure that's the best approach. It's related to #11225. It's possible that someone want to set all posts to "noindex" by global settings (if there are a lot of posts) and manually set "index" to few posts including archive page. In this case there is inconsistency between sitemap and "indexable" posts (search engines should have not problems finding and indexing them, but they may show warnings). I'll create PR which will fix it in next weeks. Similar issues (which could be fixed): #11225, #9953, #10312. Maybe it's possible to merge all of them into one issue. |
No there are valid use cases where you'd want the archive indexed, looking forward to that PR @stodorovic :) |
Hi, any news about this issue, is it fixed now please? |
It isn't fixed. I've created couple PRs related to sitemaps in meantime and I didn't find time for this issue. I'll try to create PR soon (it could be my next PR related to sitemaps). |
Just found this issue after experiencing the exact problem myself with a CPT. In my case, I deliberately want to not index the single CPT posts, but I also deliberately do want to index (and include in sitemap) the CPT archive page. Therefore I definitely would not like to see the CPT archive setting hidden, as suggested by tacoverdo above. ;) I'm glad you're working on a fix for this! |
+1 for this. I need to include a CPT Archive, but exclude all the Single Posts. Had to switch to a different Sitemap generator until this is fixed :( |
Almost 6 months since this issue has been reported, any news about a fix? |
Any news please? |
This issue currently has no priority and is not being worked on from within our development team. We do welcome any community patches that would fix this though. Once this is being picked up, this thread will get notified. |
Hi @Djennez, is it likely that this issue will be picked up at some point in the future? Or are you saying that it's a "won't fix" issue for your team? @stodorovic had mentioned, back in January, that he would try and create a PR for it soon. :) As it's effectively a bug of sorts, and @jdevalk has commented that there are valid use-cases for this scenario, then surely it needs to be fixed/implimented? :) |
This bug is incredible, the only way I found to solve the problem is to set each post as noindex from the advanced yoast settings of the single post. |
@Djennez It's been a while. Will this issue be fixed anytime in the future? |
I don't believe this has been planned in any of the future projects yet. @JessieHenkes can this possibly be included in the Indexable sitemap overhaul? Or is it too much out of scope for that? |
@JessieHenkes Any follow up on this? |
As soon as it's worked on / fixed, you'll see this thread being updated. |
@Djennez Sorry. I don't mean to bother anyone. I know you have lives and such. :) |
@studioavanti @shikkaba @GermanKiwi I've recently stumbled into this bug and thanks to some new filters in Yoast SEO was able to come up with a quick solution that helped me. Sharing it with you (just change $post_type value to whatever post type archive you want to add): https://wordpressify.ru/2020/12/dobavlenie-svoej-ssylki-v-sitemap-stranits-yoast-seo/ |
@acerus thanks so much for providing that function! It works well, and in the absence of an official fix from the developers, this is a really good workaround. I've actually made a couple of small adjustments to the function, and I'll paste my version of it below. In short: I noticed that your version was outputting the date in the page-sitemap.xml file in this format: 2020-12-20 05:16 Whereas the dates for every other page in this file use the following format: 2020-12-20T04:16:44+00:00 So in order to get this format, I've tweaked your function to look like this:
Key things I changed:
Hope that's helpful! |
Thank you, those are actually very helpful adjustments! |
Please give us a description of what happened.
Setting a custom post type not to be indexed will remove it from the sitemap and add a "noindex" to all posts in the CPT.
The Yoast plugin has the option of treating the CPT Archive page separately, by letting you index the archive pages. However, selecting "Yes" in "Show CPT Archive in search results" will not add the CPT Archive to the sitemap, even if the pages do not get a "noindex".
Please describe what you expected to happen and why.
I expected that the CPT Archive page would appear in the sitemap.
How can we reproduce this behavior?
1.Create a Custom Post Type.
2.Go to SEO -> Search Appearance -> Content Types
3.Set the Custom Post Type not to appear in search engines.
4.Set the CPT Archive pages to appear in search engines.
5.Verify that the CPT Archive pages are not in the sitemap.
Technical info
WordPress version: 4.9.8
Yoast SEO version: 9.0.1
Tested with theme: TwentySeventeen
The text was updated successfully, but these errors were encountered: