Choose your navigation approach
Is this page helpful?
depth
parameter to retrieve more than one level of subpages or linked items if you want to show all navigation with one API call.
modular_content
property of the response.
And that’s it! You now have a dynamic menu that your content creators can manage entirely from Kontent.ai.
// Tip: Find more about Java SDK at https://kontent.ai/learn/java
import kontent.ai.delivery.*;
// Initializes a DeliveryClient
DeliveryClient client = new DeliveryClient("<YOUR_PROJECT_ID>");
// Registers the model class for navigation items
// Tip: Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models
client.registerType(NavigationItem.class);
// Gets navigation items and their linked items
CompletionStage<NavigationItem> root = client.getItem(
"root_navigation_item",
NavigationItem.class,
DeliveryParameterBuilder.params()
.linkedItemsDepth(5)
.build()
// Registers the model class for articles
client.registerType(Article.class);
// Gets specific elements of all articles
CompletionStage<List<Article>> articles = client.getItems(
Article.class,
DeliveryParameterBuilder.params()
.projection("title", "url")
.build()
);