Try our conversational search powered by Generative AI!

How to exclude/filter items from /children with "display in navigation" set to false



Im trying to implement the content delivery api and it's going pretty well.

Sofar i've managed to create an app that builds a menu and can fetch pages with blocks on navigation.

However I've not been able to identify how to exclude/filters items that have the "Display in navigation" property set to false. Normally I can check the VisibleInMenu property to reflect this value.

In the content api this property is not exposed either in the content or children call. How can I find it? Or do I manually have to implement some kind of global filter that excludes this for all calls?

Preferrably I would like to see it on the /children call of my content. 

Edited, Nov 01, 2021 11:58

I have tried to create proxy properties that display the VisibleInMenu property like so.

  public virtual bool ShowInNavigation {
            get {
                var show = this.GetPropertyValue(p => p.VisibleInMenu);
                return show;
            set { this.SetPropertyValue(p => p.VisibleInMenu, value); }

But they all show "null" even though value is true or false.

Edited, Nov 02, 2021 9:15

I guess there should be a simpler solution but this was my solution. 

I can actually find properties that randomly dissapear now.

I add them manually here:

    [ServiceConfiguration(typeof(IContentModelMapper), Lifecycle = ServiceInstanceScope.Singleton)]
    public class CustomContentModelMapper : DefaultContentConverter

        public CustomContentModelMapper(IContentTypeRepository contentTypeRepository,
                                ReflectionService reflectionService,
                                IContentModelReferenceConverter contentModelService,
                                IContentVersionRepository contentVersionRepository,
                                ContentLoaderService contentLoaderService,
                                UrlResolverService urlResolverService,
                                ContentApiConfiguration apiConfig,
                                IPropertyConverterResolver propertyConverterResolver)
                            : base(contentTypeRepository,

        public override int Order => 200;

        protected override ContentApiModel CreateDefaultModel(IContent content)
            var baseModel = base.CreateDefaultModel(content);
            if (content is SitePageData sp)
                base.AddToPropertyMap(baseModel.Properties, nameof(sp.MetaKeywords), new StringPropertyModel(new PropertyString(string.Join(", ", sp.MetaKeywords))));
                base.AddToPropertyMap(baseModel.Properties, nameof(sp.VisibleInMenu), new BooleanPropertyModel(new PropertyBoolean(sp.VisibleInMenu)));
            return baseModel;
Edited, Nov 04, 2021 7:15
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.