magento-2-blog icon indicating copy to clipboard operation
magento-2-blog copied to clipboard

Issues when disabling posts (URLs of disabled blog posts are still saved in sitemaps)

Open julianmurillosd opened this issue 4 years ago • 6 comments

For two store views (FR and EN), there have been some posts configured and created.

When the post are disabled, the URLs are still saved in the respective sitemaps (even after having generated the sitemaps), which makes Google create a warning that some submitted URLs are not being found.

Preconditions: Magento: 2.3.4 PHP: 7.3 MySQL: 5.6

julianmurillosd avatar Apr 03 '20 13:04 julianmurillosd

Hi @julianmurillosd,

Thanks for contacting us. Please download and replace the attached file follow the path:

  • app/code/Mageplaza/Blog/Model/Sitemap.php Sitemap.zip

Then, please clear all the cache re-generate the sitemap and let me know the result. Thank you!

viethung512 avatar Apr 07 '20 04:04 viethung512

Hi @viethung512

I tested it and it works; however, I notice that these adjustments create conflicts, which makes this issue appear again https://github.com/mageplaza/magento-2-blog/issues/182 (Issue 182 is about blog URLs that are created for all store views (and stored in the sitemaps), which also generates google warnings when blogs are assigned to only one store view).

Kind regards,

julianmurillosd avatar Apr 30 '20 06:04 julianmurillosd

Hi @julianmurillosd,

Sorry for the late response. Please try with this patch, I have already compared twice issue for your problem:

  • app/code/Mageplaza/Blog/Model/Sitemap.php Sitemap.zip

Please don't hesitate to contact me again if you have any other questions or problems.

Thanks!

Bang512 avatar May 06 '20 08:05 Bang512

Hello, I have a similar issue if you can advise - the previous solution of appending addFieldToFilter('enabled', ['eq' => 1]); works perfectly when a status other than "approved" is assigned. However for our purposes, we'd prefer to have posts hidden if the current date is prior to the publish date, and my team and I are unsure of how best to do this via Sitemap.php. I apologize in advance if this is something easy to solve - I've been looking for an answer here on github and in forums for a little while now, trying random things :)

kug3lblitz avatar Mar 07 '22 13:03 kug3lblitz

Hi @kug3lblitz, Please download and replace the following file:

  • app/code/Mageplaza/Blog/Model/Sitemap.php
  • https://www.dropbox.com/s/25hvn6f2nyoo179/Sitemap.php?dl=0 Then check again and confirm the result. Thank you!

giaphn avatar Mar 08 '22 07:03 giaphn

@giaphn Worked like a charm, thank you very much!

kug3lblitz avatar Mar 09 '22 14:03 kug3lblitz