Tailwind Logo

Check the upper limit of the list of links to be used in LinkList

XM CloudHeadless SXA

Published: 2024-09-18

By using a link list, you can easily add related links to a page. In this article, we will check the maximum number of items that can be used in this link list.

Confirmation of link list operation

First, create a new link list on the CMS side and create a list of links. In this case, we created a list containing 15 linked lists.

linklist01.png

When this is actually placed on the page, it will appear as follows.

linklist02.png

I have created 15 items, but only 10 are shown.

Problem-solving

Let's see how this link list works. The Rendering definition for this link list is /sitecore/layout/Renderings/Feature/JSS Experience Accelerator/Navigation/LinkList.

linklist03.png

You can see that GraphQL is defined in this item to look at the item children under the item of the specified data source. The results of this GraphQL query, as seen in Postman, are as follows.

linklist04.png

Thus, by default, the standard setting is to retrieve 10 child items. To increase this number, add the query first: 20 to get more than the standard number of data.

GraphQL
query TitleQuery($datasource: String!, $language: String!) {
  datasource: item(path: $datasource, language: $language) {
    children (first: 20){
      results {
        field(name: "Link") {
          link: jsonValue
        }
      }
    }
    field(name: "Title") {
      title: jsonValue
    }
  }
}

When run in Postman, we now have 15 pieces of data.

linklist05.png

Reflecting on the Environment

Applying the query that worked above to the items in the Link List, 15 items are now displayed when accessing the page we just placed.

linklist06.png

Summary

We can implement this in the form of a GraphQL definition for rendering, retrieving the data, and displaying it on the page, as we did before when creating the breadcrumb list. In this case, we used Postman to check the data acquisition and made changes to it. In this case, we used Postman to check the data acquisition, and only needed to change that part.

Related Links

Tags