From 905111d9dfad573e5c4398b6c34989a535e7e873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9gane=20Lacheny?= Date: Mon, 24 Nov 2025 17:21:24 +0100 Subject: [PATCH] Add tip about nested page hierarchies in CTB documentation --- .../docs/cms/features/content-type-builder.md | 27 +++++++++++++++++++ docusaurus/static/llms-code.txt | 27 +++++++++++++++++++ docusaurus/static/llms-full.txt | 27 +++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/docusaurus/docs/cms/features/content-type-builder.md b/docusaurus/docs/cms/features/content-type-builder.md index eb2cda5c6b..84d11f678f 100644 --- a/docusaurus/docs/cms/features/content-type-builder.md +++ b/docusaurus/docs/cms/features/content-type-builder.md @@ -481,6 +481,33 @@ Configuring the basic settings of the Relation field consists in choosing with w +:::tip Modeling nested page hierarchies +To model a navigable tree of pages: +1. Add a `Page` collection type with a "Slug" (UID) and (optionally) an "Order" (Integer) field to control sibling ordering. +2. Create a Relation field from `Page` to `Page` and choose *Many-to-one* so each page can set its "Parent page". Strapi automatically provides the inverse "Children pages" relation. +3. When reading data, populate `children` recursively to load the tree. Keep the recursion depth small to avoid large responses. + +
+Example +```json title="Populate nested children for a page tree" +{ + populate: { + children: { + fields: ['title', 'slug'], + populate: { + children: { + fields: ['title', 'slug'], + }, + }, + }, + }, +} +``` +
+ +The same populate pattern works with GraphQL or the Document Service API (see [Understanding populate guide](/cms/api/rest/guides/understanding-populate#populate-several-levels-deep-for-specific-relations)). +::: + #### Boolean {#boolean} The Boolean field displays a toggle button to manage boolean values (e.g. Yes or No, 1 or 0, True or False). diff --git a/docusaurus/static/llms-code.txt b/docusaurus/static/llms-code.txt index f568818578..e87612db4f 100644 --- a/docusaurus/static/llms-code.txt +++ b/docusaurus/static/llms-code.txt @@ -20373,6 +20373,33 @@ export default ({ env }) => ({ +# Content-type Builder +Source: https://docs.strapi.io/cms/features/content-type-builder + +## Relation +Description: Example +(Source: https://docs.strapi.io/cms/features/content-type-builder#relation) + +Language: JSON +File path: Populate + +```json +{ + populate: { + children: { + fields: ['title', 'slug'], + populate: { + children: { + fields: ['title', 'slug'], + }, + }, + }, + }, +} +``` + + + # Custom Fields Source: https://docs.strapi.io/cms/features/custom-fields diff --git a/docusaurus/static/llms-full.txt b/docusaurus/static/llms-full.txt index e94946376f..4f196c6ba6 100644 --- a/docusaurus/static/llms-full.txt +++ b/docusaurus/static/llms-full.txt @@ -8051,6 +8051,33 @@ Relations where at least one side can reference several entries are called multi +:::tip Modeling nested page hierarchies +To model a navigable tree of pages: +1. Add a `Page` collection type with a "Slug" (UID) and (optionally) an "Order" (Integer) field to control sibling ordering. +2. Create a Relation field from `Page` to `Page` and choose *Many-to-one* so each page can set its "Parent page". Strapi automatically provides the inverse "Children pages" relation. +3. When reading data, populate `children` recursively to load the tree. Keep the recursion depth small to avoid large responses. + +
+Example +```json title="Populate nested children for a page tree" +{ + populate: { + children: { + fields: ['title', 'slug'], + populate: { + children: { + fields: ['title', 'slug'], + }, + }, + }, + }, +} +``` +
+ +The same populate pattern works with GraphQL or the Document Service API (see [Understanding populate guide](/cms/api/rest/guides/understanding-populate#populate-several-levels-deep-for-specific-relations)). +::: + #### Boolean {#boolean} The Boolean field displays a toggle button to manage boolean values (e.g. Yes or No, 1 or 0, True or False).