Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using Newtonsoft.Json.Linq;
using Sitecore.LayoutService.Configuration;
using Sitecore.LayoutService.ItemRendering.ContentsResolvers;
using Sitecore.Mvc.Presentation;
using Sitecore.XA.JSS.Feature.Navigation.ContentsResolvers;
using System.Collections.Specialized;
namespace XmCloudSXAStarter.Patches
public class FixSxaHeadlessNavigationContentResolver : IRenderingContentsResolver
private readonly NavigationContentResolver _orginal;
public bool IncludeServerUrlInMediaUrls { get; set; }
public bool UseContextItem { get; set; }
public string ItemSelectorQuery { get; set; }
public NameValueCollection Parameters { get; set; }
public FixSxaHeadlessNavigationContentResolver()
_orginal = new NavigationContentResolver
IncludeServerUrlInMediaUrls = IncludeServerUrlInMediaUrls,
UseContextItem = UseContextItem,
ItemSelectorQuery = ItemSelectorQuery,
Parameters = Parameters
public object ResolveContents(Rendering rendering, IRenderingConfiguration renderingConfig)
var originalContents = _orginal.ResolveContents(rendering, renderingConfig);
var jObject = new JObject
new JProperty("Items", new JObject(new JProperty("value", originalContents)))
return jObject;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment