Debian Codegraph @

docs/content/en/methods/page/RegularPagesRecursive.md

raw
1 ---
2 title: RegularPagesRecursive
3 description: Returns a collection of regular pages within the current section, and regular pages within all descendant sections.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: page.Pages
9 signatures: [PAGE.RegularPagesRecursive]
10 ---
11
12 The `RegularPagesRecursive` method on a `Page` object is available to these [page kinds](g): `home`, `section`, `taxonomy`, and `term`. The templates for these page kinds receive a page [collection](g) in [context](g), in the [default sort order](g).
13
14 Range through the page collection in your template:
15
16 ```go-html-template
17 {{ range .RegularPagesRecursive.ByTitle }}
18 <h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
19 {{ end }}
20 ```
21
22 Consider this content structure:
23
24 ```tree
25 content/
26 ├── lessons/
27 │ ├── lesson-1/
28 │ │ ├── _index.md
29 │ │ ├── part-1.md
30 │ │ └── part-2.md
31 │ ├── lesson-2/
32 │ │ ├── resources/
33 │ │ │ ├── task-list.md
34 │ │ │ └── worksheet.md
35 │ │ ├── _index.md
36 │ │ ├── part-1.md
37 │ │ └── part-2.md
38 │ ├── _index.md
39 │ ├── grading-policy.md
40 │ └── lesson-plan.md
41 ├── _index.md
42 ├── contact.md
43 └── legal.md
44 ```
45
46 When rendering the home page, the `RegularPagesRecursive` method returns:
47
48 contact.md
49 lessons/grading-policy.md
50 legal.md
51 lessons/lesson-plan.md
52 lessons/lesson-2/part-1.md
53 lessons/lesson-1/part-1.md
54 lessons/lesson-2/part-2.md
55 lessons/lesson-1/part-2.md
56 lessons/lesson-2/resources/task-list.md
57 lessons/lesson-2/resources/worksheet.md
58
59 When rendering the lessons page, the `RegularPagesRecursive` method returns:
60
61 lessons/grading-policy.md
62 lessons/lesson-plan.md
63 lessons/lesson-2/part-1.md
64 lessons/lesson-1/part-1.md
65 lessons/lesson-2/part-2.md
66 lessons/lesson-1/part-2.md
67 lessons/lesson-2/resources/task-list.md
68 lessons/lesson-2/resources/worksheet.md
69
70 When rendering lesson-1, the `RegularPagesRecursive` method returns:
71
72 lessons/lesson-1/part-1.md
73 lessons/lesson-1/part-2.md
74
75 When rendering lesson-2, the `RegularPagesRecursive` method returns:
76
77 lessons/lesson-2/part-1.md
78 lessons/lesson-2/part-2.md
79 lessons/lesson-2/resources/task-list.md
80 lessons/lesson-2/resources/worksheet.md
81
82 > [!NOTE]
83 > The `RegularPagesRecursive` method is not available on a `Site` object.