magento-2-blog
magento-2-blog copied to clipboard
Issues when disabling posts (URLs of disabled blog posts are still saved in sitemaps)
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
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!
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,
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!
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 :)
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 Worked like a charm, thank you very much!