0

We are using a 2sxc module on an DNN Evoq install, there are multiple instances of 2sxc module app on a page which are inserted in lot of pages.

Can we disable search from indexing the content of one particular 2sxc module through its template file using razor code?

user366123
  • 153
  • 10

1 Answers1

1

Yes you can :)

It's a bit tricky but each razor can modify what / how something is indexed, this is often needed when indexing List/Details-pages. Here's the starting point in the docs: https://github.com/2sic/2sxc/wiki/Razor-SexyContentWebPage.CustomizeSearch

I would try the following (haven't tried it myself, but should work)

@functions
{
  /// <summary>
  /// Populate the search - ensure that each entity has an own url/page
  /// </summary>
  /// <param name="searchInfos"></param>
  /// <param name="moduleInfo"></param>
  /// <param name="startDate"></param>
  public override void CustomizeSearch(Dictionary<string, List<ToSic.SexyContent.Search.ISearchInfo>> searchInfos, DotNetNuke.Entities.Modules.ModuleInfo moduleInfo, DateTime startDate)
  {
      // clear the search-infos
      searchInfos["Default"] = new List<ToSic.SexyContent.Search.ISearchInfo>();
  }
}
iJungleBoy
  • 5,325
  • 1
  • 9
  • 21
  • I can't get my head around it, could you help with a sample code? Because my efforts has resulted in general exception errors in the admin log – user366123 Apr 14 '17 at 07:09