You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/cms/features/content-type-builder.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -481,6 +481,33 @@ Configuring the basic settings of the Relation field consists in choosing with w
481
481
482
482
</Tabs>
483
483
484
+
:::tip Modeling nested page hierarchies
485
+
To model a navigable tree of pages:
486
+
1. Add a `Page` collection type with a "Slug" (UID) and (optionally) an "Order" (Integer) field to control sibling ordering.
487
+
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.
488
+
3. When reading data, populate `children` recursively to load the tree. Keep the recursion depth small to avoid large responses.
489
+
490
+
<details>
491
+
<summary>Example</summary>
492
+
```json title="Populate nested children for a page tree"
493
+
{
494
+
populate: {
495
+
children: {
496
+
fields: ['title', 'slug'],
497
+
populate: {
498
+
children: {
499
+
fields: ['title', 'slug'],
500
+
},
501
+
},
502
+
},
503
+
},
504
+
}
505
+
```
506
+
</details>
507
+
508
+
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)).
Copy file name to clipboardExpand all lines: docusaurus/static/llms-full.txt
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8114,6 +8114,33 @@ Relations where at least one side can reference several entries are called multi
8114
8114
8115
8115
</Tabs>
8116
8116
8117
+
:::tip Modeling nested page hierarchies
8118
+
To model a navigable tree of pages:
8119
+
1. Add a `Page` collection type with a "Slug" (UID) and (optionally) an "Order" (Integer) field to control sibling ordering.
8120
+
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.
8121
+
3. When reading data, populate `children` recursively to load the tree. Keep the recursion depth small to avoid large responses.
8122
+
8123
+
<details>
8124
+
<summary>Example</summary>
8125
+
```json title="Populate nested children for a page tree"
8126
+
{
8127
+
populate: {
8128
+
children: {
8129
+
fields: ['title', 'slug'],
8130
+
populate: {
8131
+
children: {
8132
+
fields: ['title', 'slug'],
8133
+
},
8134
+
},
8135
+
},
8136
+
},
8137
+
}
8138
+
```
8139
+
</details>
8140
+
8141
+
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)).
0 commit comments