Excluding the search page from the site map

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi all,

Ok so I'm not sure how exactly to do this, but how would I go about excluding the search page from the site map.

So https://mydomain.com/search

I couldn't see anything obvious in the backend, nor could I see a sitemap.xml file

Cheers
6 years ago
Unfortunately you cannot without a plugin or code change. Search page is added with this code (nopCommerce 4.00, nop400\Libraries\Nop.Services\Seo\SitemapGenerator.cs):

//search products
var productSearchUrl = urlHelper.RouteUrl("ProductSearch", null, GetHttpProtocol());
sitemapUrls.Add(new SitemapUrl(productSearchUrl, UpdateFrequency.Weekly, DateTime.UtcNow));


If you are using nopCommerce source code version than you can modify the file. But better approach is keep source code as is and build a plugin. The plugin will have your own class that is inherited Nop.Services.Seo.SitemapGenerator class. After that existing SitemapGenerator should be unregistered from dependency injection repository, and you new class should be registered there. You can take a look to nop400\Presentation\Nop.Web.Framework\Infrastructure\DependencyRegistrar.cs class how to do that.
6 years ago
webdevdude wrote:
Hi all,

Ok so I'm not sure how exactly to do this, but how would I go about excluding the search page from the site map.

So https://mydomain.com/search

I couldn't see anything obvious in the backend, nor could I see a sitemap.xml file

Cheers


Please try our plugin - blog post.
5 years ago
Being that we cannot change the search page in the sitemap, can we at least get rid of the redirect to /filterSearch?

Regards
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.