Include sitemap for blog posts

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 anni tempo fa
Hello,

sitemapxmlsettings.sitemapxmlincludeblogposts is set to True, but the sitemap.xml does NOT include the blog posts.
Is it a bug?

Z
4 anni tempo fa
It's Nop V4.2
4 anni tempo fa
Anyone help?
4 anni tempo fa
Hi,
I'm having the same issue, blogs, news items do not appear in the sitemap.  Responses on this forum in recent years have dropped dramatically unfortunately.
3 anni tempo fa
Hi, I hope my answer will help you people or the ones that will comes here in future.

I faced this same issue for my news posts. After hours of exploring nop commerce source code. I found the cause & fix for this issue.

Fix: Add one more language from your admin - https://www.yourstore.com/Admin/Language/Create. (yes this seems awkward solution, but worth using until nopcommerce team fix the issue)

Cause:
It's due to the method (Nop.Services.Seo.)UrlRecordService.GetSeName has a params called "ensureTwoPublishedLanguages" set "true" as a default value. This makes further inner codes to pass language id only when two or more languages are there in the store. otherwise "0" will be passed for database queries. But in the database your default(and only one) language (probably english) will have id as "1".  So url records table won't have any news/blog post urls with language id as '0' ending up with zero urls for news or blogs. So adding one more language makes the above method to pass language id correctly and all urls for news/blog posts will be pulled from database.
3 anni tempo fa
EcomRockstar wrote:
Hi, I hope my answer will help you people or the ones that will comes here in future.

I faced this same issue for my news posts. After hours of exploring nop commerce source code. I found the cause & fix for this issue.

Fix: Add one more language from your admin - https://www.yourstore.com/Admin/Language/Create. (yes this seems awkward solution, but worth using until nopcommerce team fix the issue)

Cause:
It's due to the method (Nop.Services.Seo.)UrlRecordService.GetSeName has a params called "ensureTwoPublishedLanguages" set "true" as a default value. This makes further inner codes to pass language id only when two or more languages are there in the store. otherwise "0" will be passed for database queries. But in the database your default(and only one) language (probably english) will have id as "1".  So url records table won't have any news/blog post urls with language id as '0' ending up with zero urls for news or blogs. So adding one more language makes the above method to pass language id correctly and all urls for news/blog posts will be pulled from database.


Thanks for the investigation. We've fixed this issue.
Could you please post bug reports on this forum in the future, it'll be of more worth.
3 anni tempo fa
Is there a fix for version 4.2 ?
I noticed on there's no cachekeyservice in PrepareSitemapModel function.
(in fact there's no such service anywhere I can find!)
here's what I see
      var cacheKey = string.Format(NopModelCacheDefaults.SitemapPageModelKey,
                _workContext.WorkingLanguage.Id,
                string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()),
                _storeContext.CurrentStore.Id);
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.