Try our conversational search powered by Generative AI!

ShouldExcludeContent not hitting breakpoint


Following the instructions in geta-optimizely-sitemaps we have implemented additional logic in ShouldExcludeContent method but when running the Generate search engine sitemaps job no break-points in this override are hit and the logic written in here does not apply. 

Anyone else ran into this or has any ideas why that is so?

Jun 20, 2023 12:24

have you registered it 

services.AddTransient<IContentFilter, SiteContentFilter>();

Jun 20, 2023 12:33
EVT - Jun 20, 2023 12:40
Yes I have

I did a (very) quick look at the repository you linked, and it seems the default implementation is registered like this

and it seems you need to override the default implementation. i.e. your registration needs to be after AddSitemaps

You probably want to make your registration Singleton as well

Jun 20, 2023 12:46

I have noticed that it was singeton in the default implementation, tested singleton, no difference. 

It is an override 

not sure what you mean with "after AddSitemaps", is it this?

Edited, Jun 20, 2023 13:00

I meant something like this


services.AddSingleton<IContentFilter, GetaSiteMapContentFilter>();

the default implementation is registered in AddSiteMaps, so yours needs to be registered after to override it (not the override method as you thought) :)

Jun 20, 2023 13:06

Removed registration from DependencyExtensions and added in Startup in the suggested order and it worked. 

Kept the transient though.

Thank you

Jun 20, 2023 13:27
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.