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 JS/TS SDKs at https://kontent.ai/learn/javascript
import { createDeliveryClient } from '@kontent-ai/delivery-sdk';
import { Article } from './models/Article';
import { NavigationItem } from './models/NavigationItem';
const deliveryClient = createDeliveryClient({
environmentId: '8d20758c-d74c-4f59-ae04-ee928c0816b7',
});
// Gets navigation items and their linked items
let root: NavigationItem;
const rootResponse = await deliveryClient.item<NavigationItem>('root_navigation_item')
.depthParameter(5)
.toPromise();
root = rootResponse.data.item;
// Gets specific elements of all articles
let articles: Article[];
const articleResponse = await deliveryClient.items<Article>()
.type('article')
.elementsParameter(['title', 'url'])
.toPromise();
articles = articleResponse.data.items;