Skip navigation

Retrieve linked items and subpages

6 min read
Download PDF

Sometimes you want to reuse bits of your content in various places. Other times, you want to show how different pieces of content are related, such as who wrote an article. In situations like these, you're going to want to structure your content as separate items and then use linked items to show their connections.

If you're using Web Spotlight to manage your website, your content is organized in a page tree for easy navigation. You can work with the pages the same way as you would with linked items. See how to retrieve subpages of a single page.

Table of contents

    How linked items help you

    One of the benefits of using an API-first CMS like Kontent.ai is that your content is all structured and ready to be reused. You can define many elements for a given content item and use different ones in different contexts. For example, you might have a full article with catchy copy and captivating images, but only want to use its title and a brief description in a list of articles. When you put your content into various structured items and then link those together to build relationships, you can define what gets used where.

    Some benefits from having content in separate items:

    • You can have separate workflows for separate pieces of content. For example, you can have a homepage with many testimonials and have some published and some in other steps.
    • You can reuse the items, so you only have to edit content once for the changes to appear in many places. For example, you can have an author's bio appear on all the articles they've written.
    • You don't need to plan exactly what content will be included in each section – you only need to give the opportunity to add linked items. For example, you can have a product listing where you later decide which products will appear and in which order.

    With Kontent.ai, you can link content together in two ways:

    1. Using a Linked items element – here, you can limit the items, including what types can be included and how many. This way is covered here.
    2. In a Rich text element – here, your items are included within the text, which requires additional work from your app to render them. Read how to deal with structure in your rich text.

    This article will look at how to use linked items to add an author with a name and bio to your articles. You might do this if you have an author who is writing multiple articles and wants the chance to edit their bio separately. If you have not yet done so, create at least one author and link it to an article.

    Add your relationships to your model

    If you're using strongly typed models, you should remember to add your Author model as well as add a linked items element to your Simple Article model.

    The following example shows the Author model in various languages.

    • Java
    // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models import java.lang.String; import java.util.List; import kontent.ai.delivery.ContentItemMapping; import kontent.ai.delivery.ElementMapping; import kontent.ai.delivery.System; @ContentItemMapping("author") public class Homepage { @ElementMapping("name") String name; @ElementMapping("bio") String bio; System system; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBio() { return bio; } public void setBio(String bio) { this.bio = bio; } public System getSystem() { return system; } public void setSystem(System system) { this.system = system; } }
    // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models import java.lang.String; import java.util.List; import kontent.ai.delivery.ContentItemMapping; import kontent.ai.delivery.ElementMapping; import kontent.ai.delivery.System; @ContentItemMapping("author") public class Homepage { @ElementMapping("name") String name; @ElementMapping("bio") String bio; System system; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBio() { return bio; } public void setBio(String bio) { this.bio = bio; } public System getSystem() { return system; } public void setSystem(System system) { this.system = system; } }
    • C#
    // Create strongly typed models according to https://kontent.ai/learn/net-strong-types using System; using System.Collections.Generic; using Kontent.Ai.Delivery.Abstractions; namespace KontentAiModels { public partial class Author { public const string Codename = "author"; public const string NameCodename = "name"; public const string BioCodename = "bio"; public string Name { get; set; } public IRichTextContent Bio { get; set; } } }
    // Create strongly typed models according to https://kontent.ai/learn/net-strong-types using System; using System.Collections.Generic; using Kontent.Ai.Delivery.Abstractions; namespace KontentAiModels { public partial class Author { public const string Codename = "author"; public const string NameCodename = "name"; public const string BioCodename = "bio"; public string Name { get; set; } public IRichTextContent Bio { get; set; } } }
    • TypeScript
    // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models import { IContentItem, Elements } from '@kontent-ai/delivery-sdk'; export type Author = IContentItem<{ name: Elements.TextElement; bio: Elements.RichTextElement; }>;
    // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models import { IContentItem, Elements } from '@kontent-ai/delivery-sdk'; export type Author = IContentItem<{ name: Elements.TextElement; bio: Elements.RichTextElement; }>;

    The following examples show a Simple Article content type with a title, body, and author.

    • Java
    // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models import java.lang.String; import java.util.List; import kontent.ai.delivery.ContentItemMapping; import kontent.ai.delivery.ElementMapping; import kontent.ai.delivery.System; @ContentItemMapping("simple_article") public class Homepage { @ElementMapping("title") String title; @ElementMapping("body") String body; @ContentItemMapping("author") List<ContentItem> author; System system; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } public List<ContentItem> getAuthor() { return author; } public void setAuthor(List<ContentItem> author) { this.author = author; } public System getSystem() { return system; } public void setSystem(System system) { this.system = system; } }
    // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models import java.lang.String; import java.util.List; import kontent.ai.delivery.ContentItemMapping; import kontent.ai.delivery.ElementMapping; import kontent.ai.delivery.System; @ContentItemMapping("simple_article") public class Homepage { @ElementMapping("title") String title; @ElementMapping("body") String body; @ContentItemMapping("author") List<ContentItem> author; System system; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } public List<ContentItem> getAuthor() { return author; } public void setAuthor(List<ContentItem> author) { this.author = author; } public System getSystem() { return system; } public void setSystem(System system) { this.system = system; } }
    • C#
    // Create strongly typed models according to https://kontent.ai/learn/net-strong-types using System; using System.Collections.Generic; using Kontent.Ai.Delivery.Abstractions; namespace KontentAiModels { public partial class SimpleArticle { public const string Codename = "simple_article"; public const string TitleCodename = "title"; public const string BodyCodename = "body"; public const string AuthorCodename = "author"; public string Title { get; set; } public string Body { get; set; } public IEnumerable<object> Author { get; set; } public IContentItemSystemAttributes System { get; set; } } }
    // Create strongly typed models according to https://kontent.ai/learn/net-strong-types using System; using System.Collections.Generic; using Kontent.Ai.Delivery.Abstractions; namespace KontentAiModels { public partial class SimpleArticle { public const string Codename = "simple_article"; public const string TitleCodename = "title"; public const string BodyCodename = "body"; public const string AuthorCodename = "author"; public string Title { get; set; } public string Body { get; set; } public IEnumerable<object> Author { get; set; } public IContentItemSystemAttributes System { get; set; } } }
    • TypeScript
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript import { IContentItem, Elements } from '@kontent-ai/delivery-sdk'; import { Author } from './models/author'; // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models export type SimpleArticle = IContentItem<{ title: Elements.TextElement; body: Elements.RichTextElement; author: Elements.LinkedItemsElement<Author>[]; }>;
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript import { IContentItem, Elements } from '@kontent-ai/delivery-sdk'; import { Author } from './models/author'; // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models export type SimpleArticle = IContentItem<{ title: Elements.TextElement; body: Elements.RichTextElement; author: Elements.LinkedItemsElement<Author>[]; }>;

    Retrieve authors with articles

    Now, you can retrieve any articles along with their associated authors. When retrieving articles, make sure the depth query parameter is higher than 0 (the default value is 1) so that the authors will be returned. Note that any other filtering or order you do to the article will not affect what items are returned within the Linked items element.

    The following examples show how to retrieve a single article (named The Origin of Coffee) with its author (a linked item).

    If you want to include more than one level of linked items in the response, set the depth query parameter to 2 or more.

    • Java
    // 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>"); // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models // Registers the model class for simple articles client.registerType(SimpleArticle.class); CompletionStage<SimpleArticle> item = client.getItem( "the_origin_of_coffee", SimpleArticle.class, DeliveryParameterBuilder.params() .linkedItemsDepth(1) .build() );
    // 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>"); // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models // Registers the model class for simple articles client.registerType(SimpleArticle.class); CompletionStage<SimpleArticle> item = client.getItem( "the_origin_of_coffee", SimpleArticle.class, DeliveryParameterBuilder.params() .linkedItemsDepth(1) .build() );
    • JavaScript
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript const KontentDelivery = require('@kontent-ai/delivery-sdk'); const deliveryClient = KontentDelivery.createDeliveryClient({ environmentId: '8d20758c-d74c-4f59-ae04-ee928c0816b7', }); const response = await deliveryClient.item('the_origin_of_coffee') .depthParameter(1) .toPromise();
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript const KontentDelivery = require('@kontent-ai/delivery-sdk'); const deliveryClient = KontentDelivery.createDeliveryClient({ environmentId: '8d20758c-d74c-4f59-ae04-ee928c0816b7', }); const response = await deliveryClient.item('the_origin_of_coffee') .depthParameter(1) .toPromise();
    • C#
    // Tip: Find more about .NET SDKs at https://kontent.ai/learn/net using Kontent.Ai.Delivery; // Creates an instance of the delivery client // ProTip: Use DI for this in your apps https://kontent.ai/learn/net-register-client IDeliveryClient client = DeliveryClientBuilder .WithProjectId("8d20758c-d74c-4f59-ae04-ee928c0816b7") .Build(); // Gets a specific article and its linked items // Create strongly typed models according to https://kontent.ai/learn/net-strong-types IDeliveryItemResponse<SimpleArticle> response = await client.GetItemAsync<SimpleArticle>("the_origin_of_coffee", new DepthParameter(1) ); SimpleArticle item = response.Item;
    // Tip: Find more about .NET SDKs at https://kontent.ai/learn/net using Kontent.Ai.Delivery; // Creates an instance of the delivery client // ProTip: Use DI for this in your apps https://kontent.ai/learn/net-register-client IDeliveryClient client = DeliveryClientBuilder .WithProjectId("8d20758c-d74c-4f59-ae04-ee928c0816b7") .Build(); // Gets a specific article and its linked items // Create strongly typed models according to https://kontent.ai/learn/net-strong-types IDeliveryItemResponse<SimpleArticle> response = await client.GetItemAsync<SimpleArticle>("the_origin_of_coffee", new DepthParameter(1) ); SimpleArticle item = response.Item;
    • PHP
    // Tip: Find more about PHP SDKs at https://kontent.ai/learn/php // Defined by Composer to include required libraries require __DIR__ . '/vendor/autoload.php'; use Kontent\Ai\Delivery\DeliveryClient; $client = new DeliveryClient('8d20758c-d74c-4f59-ae04-ee928c0816b7'); $item = $client->getItem('the_origin_of_coffee', (new QueryParams()) ->depth(1));
    // Tip: Find more about PHP SDKs at https://kontent.ai/learn/php // Defined by Composer to include required libraries require __DIR__ . '/vendor/autoload.php'; use Kontent\Ai\Delivery\DeliveryClient; $client = new DeliveryClient('8d20758c-d74c-4f59-ae04-ee928c0816b7'); $item = $client->getItem('the_origin_of_coffee', (new QueryParams()) ->depth(1));
    • cURL
    curl --request GET \ --url 'https://deliver.kontent.ai/8d20758c-d74c-4f59-ae04-ee928c0816b7/items/the_origin_of_coffee?depth=1' \ --header 'content-type: application/json'
    curl --request GET \ --url 'https://deliver.kontent.ai/8d20758c-d74c-4f59-ae04-ee928c0816b7/items/the_origin_of_coffee?depth=1' \ --header 'content-type: application/json'
    • Ruby
    # Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby require 'delivery-sdk-ruby' delivery_client = Kontent::Ai::Delivery::DeliveryClient.new project_id: '8d20758c-d74c-4f59-ae04-ee928c0816b7' delivery_client.item('the_origin_of_coffee') .depth(1) .execute do |response| item = response.item puts response.json end
    # Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby require 'delivery-sdk-ruby' delivery_client = Kontent::Ai::Delivery::DeliveryClient.new project_id: '8d20758c-d74c-4f59-ae04-ee928c0816b7' delivery_client.item('the_origin_of_coffee') .depth(1) .execute do |response| item = response.item puts response.json end
    • TypeScript
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript import { createDeliveryClient } from '@kontent-ai/delivery-sdk'; import { Author } from './models/Author'; import { SimpleArticle } from './models/SimpleArticle'; const deliveryClient = createDeliveryClient({ environmentId: '8d20758c-d74c-4f59-ae04-ee928c0816b7' }); const response = await deliveryClient.item<SimpleArticle>('the_origin_of_coffee') .depthParameter(1) .toPromise(); const article: SimpleArticle = response.data.item; const author: Author = article.elements.author;
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript import { createDeliveryClient } from '@kontent-ai/delivery-sdk'; import { Author } from './models/Author'; import { SimpleArticle } from './models/SimpleArticle'; const deliveryClient = createDeliveryClient({ environmentId: '8d20758c-d74c-4f59-ae04-ee928c0816b7' }); const response = await deliveryClient.item<SimpleArticle>('the_origin_of_coffee') .depthParameter(1) .toPromise(); const article: SimpleArticle = response.data.item; const author: Author = article.elements.author;

    In the default JSON response, the codename for your author (jane in our example) will appear in the value of your author element. If you had multiple authors, they would appear in the same order in the author element as they do in the UI.

    Jane's name and bio will appear in the modular_content collection under her codename. So to use Jane within your article, all you have to do is match the codename from the author element with the values you want to use from the jane collection.

    • JSON
    { "item": { "system": { "id": "4735c956-4be4-482c-b874-bba201a22f44", "name": "The Origin of Coffee", "codename": "the_origin_of_coffee", "language": "en-US", "type": "simple_article", "sitemap_locations": [], "last_modified": "2020-02-03T12:36:02.7767984Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "The Origin of Coffee" }, "author": { "type": "modular_content", "name": "Author", "value": [ "jane_doe" ] }, "body": { "type": "rich_text", "name": "Body", "images": {}, "links": {}, "modular_content": [], "value": "<p>The history of coffee is patchy and full of myth and hearsay. Although it's far more likely that uses for coffee were developed over time and were discovered by people tasting various parts of the cherry, the old fables do add a bit of romance and are very cute.</p>" } } }, "modular_content": { "jane_doe": { "system": { "id": "3bf1c09b-4552-4e2c-8de5-ffce79f773e0", "name": "Jane Doe", "codename": "jane_doe", "language": "en-US", "type": "author", "sitemap_locations": [], "last_modified": "2020-02-03T12:30:14.641708Z" }, "elements": { "name": { "type": "text", "name": "Name", "value": "Jane Doe" }, "bio": { "type": "rich_text", "name": "Bio", "images": {}, "links": {}, "modular_content": [], "value": "<p>Jane is a fun-loving writer who enjoys her coffee black as hell, strong as death, and sweet as love.</p>" } } } } }
    { "item": { "system": { "id": "4735c956-4be4-482c-b874-bba201a22f44", "name": "The Origin of Coffee", "codename": "the_origin_of_coffee", "language": "en-US", "type": "simple_article", "sitemap_locations": [], "last_modified": "2020-02-03T12:36:02.7767984Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "The Origin of Coffee" }, "author": { "type": "modular_content", "name": "Author", "value": [ "jane_doe" ] }, "body": { "type": "rich_text", "name": "Body", "images": {}, "links": {}, "modular_content": [], "value": "<p>The history of coffee is patchy and full of myth and hearsay. Although it's far more likely that uses for coffee were developed over time and were discovered by people tasting various parts of the cherry, the old fables do add a bit of romance and are very cute.</p>" } } }, "modular_content": { "jane_doe": { "system": { "id": "3bf1c09b-4552-4e2c-8de5-ffce79f773e0", "name": "Jane Doe", "codename": "jane_doe", "language": "en-US", "type": "author", "sitemap_locations": [], "last_modified": "2020-02-03T12:30:14.641708Z" }, "elements": { "name": { "type": "text", "name": "Name", "value": "Jane Doe" }, "bio": { "type": "rich_text", "name": "Bio", "images": {}, "links": {}, "modular_content": [], "value": "<p>Jane is a fun-loving writer who enjoys her coffee black as hell, strong as death, and sweet as love.</p>" } } } } }

    Retrieve subpages

    When using Web Spotlight to manage your website content, you can retrieve subpages the same way as your linked items.

    The following example shows how to retrieve a single page (Insurance listing) with its subpages (travel, car, and health insurance). Both the Insurance listing page and its subpages are of the Page type.

    If you're using strongly typed models, you should remember to add a subpages element to your Page model.

    When retrieving pages, make sure the depth query parameter is higher than 0 (the default value is 1) so that the subpages will be returned.

    • Java
    // 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>"); // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models // Registers the model class for articles client.registerType(Page.class); CompletionStage<Page> item = client.getItem( "insurance_listing", Page.class, DeliveryParameterBuilder.params() .linkedItemsDepth(1) .build() );
    // 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>"); // Create strongly typed models according to https://kontent.ai/learn/strongly-typed-models // Registers the model class for articles client.registerType(Page.class); CompletionStage<Page> item = client.getItem( "insurance_listing", Page.class, DeliveryParameterBuilder.params() .linkedItemsDepth(1) .build() );
    • JavaScript
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript const KontentDelivery = require('@kontent-ai/delivery-sdk'); const deliveryClient = KontentDelivery.createDeliveryClient({ environmentId: '8d20758c-d74c-4f59-ae04-ee928c0816b7' }); const response = await deliveryClient.item('insurance_listing') .depthParameter(1) .toPromise();
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript const KontentDelivery = require('@kontent-ai/delivery-sdk'); const deliveryClient = KontentDelivery.createDeliveryClient({ environmentId: '8d20758c-d74c-4f59-ae04-ee928c0816b7' }); const response = await deliveryClient.item('insurance_listing') .depthParameter(1) .toPromise();
    • C#
    // Tip: Find more about .NET SDKs at https://kontent.ai/learn/net using Kontent.Ai.Delivery; // Creates an instance of the delivery client // ProTip: Use DI for this in your apps https://kontent.ai/learn/net-register-client IDeliveryClient client = DeliveryClientBuilder .WithProjectId("8d20758c-d74c-4f59-ae04-ee928c0816b7") .Build(); // Gets a specific page, its subpages, and linked items // Create strongly typed models according to https://kontent.ai/learn/net-strong-types IDeliveryItemResponse<Page> response = await client.GetItemAsync<Page>("insurance_listing", new DepthParameter(1) ); Page item = response.Item;
    // Tip: Find more about .NET SDKs at https://kontent.ai/learn/net using Kontent.Ai.Delivery; // Creates an instance of the delivery client // ProTip: Use DI for this in your apps https://kontent.ai/learn/net-register-client IDeliveryClient client = DeliveryClientBuilder .WithProjectId("8d20758c-d74c-4f59-ae04-ee928c0816b7") .Build(); // Gets a specific page, its subpages, and linked items // Create strongly typed models according to https://kontent.ai/learn/net-strong-types IDeliveryItemResponse<Page> response = await client.GetItemAsync<Page>("insurance_listing", new DepthParameter(1) ); Page item = response.Item;
    • PHP
    // Tip: Find more about PHP SDKs at https://kontent.ai/learn/php // Defined by Composer to include required libraries require __DIR__ . '/vendor/autoload.php'; use Kontent\Ai\Delivery\DeliveryClient; $client = new DeliveryClient('8d20758c-d74c-4f59-ae04-ee928c0816b7'); $item = $client->getItem('insurance_listing', (new QueryParams()) ->depth(1));
    // Tip: Find more about PHP SDKs at https://kontent.ai/learn/php // Defined by Composer to include required libraries require __DIR__ . '/vendor/autoload.php'; use Kontent\Ai\Delivery\DeliveryClient; $client = new DeliveryClient('8d20758c-d74c-4f59-ae04-ee928c0816b7'); $item = $client->getItem('insurance_listing', (new QueryParams()) ->depth(1));
    • cURL
    curl --request GET \ --url 'https://deliver.kontent.ai/8d20758c-d74c-4f59-ae04-ee928c0816b7/items/insurance_listing?depth=1' \ --header 'content-type: application/json'
    curl --request GET \ --url 'https://deliver.kontent.ai/8d20758c-d74c-4f59-ae04-ee928c0816b7/items/insurance_listing?depth=1' \ --header 'content-type: application/json'
    • Ruby
    # Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby require 'delivery-sdk-ruby' delivery_client = Kontent::Ai::Delivery::DeliveryClient.new project_id: '8d20758c-d74c-4f59-ae04-ee928c0816b7' delivery_client.item('insurance_listing') .depth(1) .execute do |response| item = response.item puts response.json end
    # Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby require 'delivery-sdk-ruby' delivery_client = Kontent::Ai::Delivery::DeliveryClient.new project_id: '8d20758c-d74c-4f59-ae04-ee928c0816b7' delivery_client.item('insurance_listing') .depth(1) .execute do |response| item = response.item puts response.json end
    • TypeScript
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript import { createDeliveryClient } from '@kontent-ai/delivery-sdk'; import { Page } from './models/Page'; const deliveryClient = createDeliveryClient({ environmentId: '8d20758c-d74c-4f59-ae04-ee928c0816b7', }); const response = await deliveryClient.item<Page>('insurance_listing') .depthParameter(1) .toPromise();
    // Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript import { createDeliveryClient } from '@kontent-ai/delivery-sdk'; import { Page } from './models/Page'; const deliveryClient = createDeliveryClient({ environmentId: '8d20758c-d74c-4f59-ae04-ee928c0816b7', }); const response = await deliveryClient.item<Page>('insurance_listing') .depthParameter(1) .toPromise();

    In the default JSON response, the codenames for the types of insurance (travel_insurance, for example) will appear in the value of the navigation_links element. They appear in the same order in the navigation_links element as they do in the UI.

    You can find the details about each type of insurance page in the modular_content collection.

    • JSON
    { "item": { "system": { "id": "47e1a69d-9205-4be4-9ce9-78042dd4560b", "name": "Insurance listing", "codename": "insurance_listing", "language": "default", "type": "page", "sitemap_locations": [], "last_modified": "2020-09-02T12:24:44.4297022Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Insurance listing" }, "url": { "type": "url_slug", "name": "URL", "value": "insurance-listing" }, "show_in_navigation": { "type": "multiple_choice", "name": "Show in navigation", "value": [ { "name": "Yes", "codename": "yes" } ] }, "navigation_links": { "type": "modular_content", "name": "Subpages", "value": [ "travel_insurance", "car_insurance", "health_insurance" ] }, "target_content": { "type": "modular_content", "name": "Content", "value": [ "insurance_landing_page" ] } } }, "modular_content": { "car_insurance": { "system": { "id": "242d3030-e21f-488b-965f-0b170dcb144c", "name": "Car insurance", "codename": "car_insurance", "language": "default", "type": "page", "sitemap_locations": [], "last_modified": "2020-09-02T12:26:18.1255074Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Car insurance" }, "url": { "type": "url_slug", "name": "URL", "value": "car-insurance" }, "show_in_navigation": { "type": "multiple_choice", "name": "Show in navigation", "value": [ { "name": "Yes", "codename": "yes" } ] }, "navigation_links": { "type": "modular_content", "name": "Subpages", "value": [] }, "target_content": { "type": "modular_content", "name": "Content", "value": [] } } }, "health_insurance": { "system": { "id": "522624cb-afe3-4f60-b1b0-72a8b1c9ea03", "name": "Health insurance", "codename": "health_insurance", "language": "default", "type": "page", "sitemap_locations": [], "last_modified": "2020-09-02T12:26:37.1424023Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Health insurance" }, "url": { "type": "url_slug", "name": "URL", "value": "health-insurance" }, "show_in_navigation": { "type": "multiple_choice", "name": "Show in navigation", "value": [ { "name": "Yes", "codename": "yes" } ] }, "navigation_links": { "type": "modular_content", "name": "Subpages", "value": [] }, "target_content": { "type": "modular_content", "name": "Content", "value": [] } } }, "insurance_landing_page": { "system": { "id": "22f67998-5042-4456-947a-81ba7eed0467", "name": "Insurance landing page", "codename": "insurance_landing_page", "language": "default", "type": "article", "sitemap_locations": [], "last_modified": "2020-09-02T12:28:44.4123144Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Pick your insurance today!" }, "body": { "type": "rich_text", "name": "Body", "images": {}, "links": {}, "modular_content": [], "value": "<p>If you’re thinking about taking out insurance, you’ve probably asked yourself, ‘Why is it so complicated?!” It can be trying to pick a policy that suits your lifestyle, but the search will be worth it if you go about things the right way.</p>" } } }, "travel_insurance": { "system": { "id": "4b43567d-c0de-463e-94cc-62b51fe4023f", "name": "Travel insurance", "codename": "travel_insurance", "language": "default", "type": "page", "sitemap_locations": [], "last_modified": "2020-09-02T12:26:01.7874635Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Travel insurance" }, "url": { "type": "url_slug", "name": "URL", "value": "travel-insurance" }, "show_in_navigation": { "type": "multiple_choice", "name": "Show in navigation", "value": [ { "name": "Yes", "codename": "yes" } ] }, "navigation_links": { "type": "modular_content", "name": "Subpages", "value": [] }, "target_content": { "type": "modular_content", "name": "Content", "value": [] } } } } }
    { "item": { "system": { "id": "47e1a69d-9205-4be4-9ce9-78042dd4560b", "name": "Insurance listing", "codename": "insurance_listing", "language": "default", "type": "page", "sitemap_locations": [], "last_modified": "2020-09-02T12:24:44.4297022Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Insurance listing" }, "url": { "type": "url_slug", "name": "URL", "value": "insurance-listing" }, "show_in_navigation": { "type": "multiple_choice", "name": "Show in navigation", "value": [ { "name": "Yes", "codename": "yes" } ] }, "navigation_links": { "type": "modular_content", "name": "Subpages", "value": [ "travel_insurance", "car_insurance", "health_insurance" ] }, "target_content": { "type": "modular_content", "name": "Content", "value": [ "insurance_landing_page" ] } } }, "modular_content": { "car_insurance": { "system": { "id": "242d3030-e21f-488b-965f-0b170dcb144c", "name": "Car insurance", "codename": "car_insurance", "language": "default", "type": "page", "sitemap_locations": [], "last_modified": "2020-09-02T12:26:18.1255074Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Car insurance" }, "url": { "type": "url_slug", "name": "URL", "value": "car-insurance" }, "show_in_navigation": { "type": "multiple_choice", "name": "Show in navigation", "value": [ { "name": "Yes", "codename": "yes" } ] }, "navigation_links": { "type": "modular_content", "name": "Subpages", "value": [] }, "target_content": { "type": "modular_content", "name": "Content", "value": [] } } }, "health_insurance": { "system": { "id": "522624cb-afe3-4f60-b1b0-72a8b1c9ea03", "name": "Health insurance", "codename": "health_insurance", "language": "default", "type": "page", "sitemap_locations": [], "last_modified": "2020-09-02T12:26:37.1424023Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Health insurance" }, "url": { "type": "url_slug", "name": "URL", "value": "health-insurance" }, "show_in_navigation": { "type": "multiple_choice", "name": "Show in navigation", "value": [ { "name": "Yes", "codename": "yes" } ] }, "navigation_links": { "type": "modular_content", "name": "Subpages", "value": [] }, "target_content": { "type": "modular_content", "name": "Content", "value": [] } } }, "insurance_landing_page": { "system": { "id": "22f67998-5042-4456-947a-81ba7eed0467", "name": "Insurance landing page", "codename": "insurance_landing_page", "language": "default", "type": "article", "sitemap_locations": [], "last_modified": "2020-09-02T12:28:44.4123144Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Pick your insurance today!" }, "body": { "type": "rich_text", "name": "Body", "images": {}, "links": {}, "modular_content": [], "value": "<p>If you’re thinking about taking out insurance, you’ve probably asked yourself, ‘Why is it so complicated?!” It can be trying to pick a policy that suits your lifestyle, but the search will be worth it if you go about things the right way.</p>" } } }, "travel_insurance": { "system": { "id": "4b43567d-c0de-463e-94cc-62b51fe4023f", "name": "Travel insurance", "codename": "travel_insurance", "language": "default", "type": "page", "sitemap_locations": [], "last_modified": "2020-09-02T12:26:01.7874635Z" }, "elements": { "title": { "type": "text", "name": "Title", "value": "Travel insurance" }, "url": { "type": "url_slug", "name": "URL", "value": "travel-insurance" }, "show_in_navigation": { "type": "multiple_choice", "name": "Show in navigation", "value": [ { "name": "Yes", "codename": "yes" } ] }, "navigation_links": { "type": "modular_content", "name": "Subpages", "value": [] }, "target_content": { "type": "modular_content", "name": "Content", "value": [] } } } } }

    What's next?

    You've seen how to link content together through the example of adding an author to your articles. First, you model and create content in Kontent.ai. Then, you adjust your models in your app and retrieve your articles with the new relationship. You can take a similar approach in linking other content, such as adding related articles.