Auto-generate child page indexes

This way when folks browse to the index pages they'll see an
auto-generated list of child pages.

Signed-off-by: Nic Cope <nicc@rk0n.org>
This commit is contained in:
Nic Cope 2025-08-14 11:30:04 -07:00
parent d71867d6fc
commit 789826fc13
8 changed files with 31 additions and 1 deletions

View File

@ -3,3 +3,5 @@ title: Composition
weight: 51
description: Understand Crossplane's core components
---
{{< auto-index >}}

View File

@ -4,3 +4,4 @@ weight: 40
description: Get started with Crossplane.
---
{{< auto-index >}}

View File

@ -2,4 +2,6 @@
title: Guides
weight: 100
description: Crossplane integrations and detailed examples.
---
---
{{< auto-index >}}

View File

@ -3,3 +3,5 @@ title: Managed Resources
weight: 52
description: Understand Crossplane's managed resources and selective activation
---
{{< auto-index >}}

View File

@ -5,3 +5,5 @@ state: alpha
alphaVersion: 2.0
description: Understand Crossplane's Operations feature
---
{{< auto-index >}}

View File

@ -3,3 +3,5 @@ title: Packages
weight: 53
description: Understand Crossplane's core components
---
{{< auto-index >}}

View File

@ -0,0 +1,14 @@
{{/*
Auto-generates an index page with links to child pages, ordered by weight.
Usage: {{ partial "auto-index" . }}
*/}}
{{ if .RegularPages }}
<div class="auto-index">
<p>Topics in this section:</p>
<ul>
{{ range .RegularPages.ByWeight }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a>{{ if .Params.description }} - {{ .Params.description }}{{ end }}</li>
{{ end }}
</ul>
</div>
{{ end }}

View File

@ -0,0 +1,5 @@
{{/*
Shortcode to auto-generate an index of child pages.
Usage: {{< auto-index >}}
*/}}
{{ partial "auto-index" .Page }}