magefan / module-blog

Magento 2 Blog Extension is a solution that helps you to create a blog on Magento and manage posts,categories, tags, authors, and comments.
https://magefan.com/magento2-blog-extension
Other
263 stars 135 forks source link

SitemapPlugin works incorrectly on large splitted sitemaps #85

Closed Koc closed 7 years ago

Koc commented 7 years ago

Hello.

There is some problem with https://github.com/magefan/module-blog/commit/8b2fda479cc0b60b95ccaba8119c4ecde111b7ef

Before this commit sitemap generates ok:

-rw-rw-r--  1 dev dev 10499185 Aug 11 15:53 sitemap-1-1.xml
-rw-rw-r--  1 dev dev  6915337 Aug 11 15:53 sitemap-1-2.xml
-rw-rw-r--  1 dev dev      347 Aug 11 15:53 sitemap.xml

after sitemap-1-1.xml missing

-rw-rw-r--  1 dev dev  6915337 Aug 11 15:53 sitemap-1-2.xml
-rw-rw-r--  1 dev dev      347 Aug 11 15:53 sitemap.xml

but sitemap.xml refers to missing sitemap-1-1.xml

Koc commented 7 years ago

Even more - sitemap.xml file (sitemap index) does not contains your blog_sitemap.xml file

magefan commented 7 years ago

Hello @Koc , it's working as expected. This changes (8b2fda4) was made to prevent conflicts with third party extensions. So we changed "class override" approach to plugin.

By using plugin we cannot add new records to sitema.xml directly, until this issue is not releases (https://github.com/magento/magento2/issues/10045). Magento 2.1.8 does not include it.

So, our idea was to create separate xml for blog pages "blog_sitemap.xml". It not sould be included in sitemap.xml. Also I think that sitemap-1-1.xml missed due to less number of records, because, as I mentioned, we moved all informatoin ablout blog pages to separate xml file.

To let Search Engine robots read blog_sitemap.xml, please define it in robots.txt. Example: Sitemap: https://domain.com/blog_sitemap.xml

Koc commented 7 years ago

Can you please add note about this into extension documentation?

mariuszjeruzal commented 5 years ago

I think it is a bug. In my case it also removes sitemap-1-1.xml just before blog_sitemap.xml is generated. I tested it on Magento 2.2.3. The solution is to remove from: Magefan\Blog\Model\Sitemap.php Line ~24: $this->_sitemapItems = [];

magefan commented 5 years ago

@mariuszjeruzal , can you confirm that you use latest blog v2.8.7 ?

mariuszjeruzal commented 5 years ago

No it is 2.6.2. I see that in 2.8.7 there were changes to Sitemap.php - I will check it with the newest version and let you know

magefan commented 5 years ago

@mariuszjeruzal , can you confirm that it is working for you on blog v2.8.7 ?

mariuszjeruzal commented 5 years ago

@magefan Magento 2.2.3 Blog 2.8.7 is working correctly