mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
2.9 KiB
2.9 KiB
+++ alwaysopen = false frontmatter = ["ordersectionsby"] options = ["ordersectionsby"] description = "List the child pages of a page" title = "Children" +++
The children
shortcode lists the child pages of the current page and its descendants.
{{% children sort="title" %}}
Usage
{{< tabs groupid="shortcode-parameter">}} {{% tab title="shortcode" %}}
{{%/* children sort="title" */%}}
{{% /tab %}} {{% tab title="partial" %}}
{{ partial "shortcodes/children.html" (dict
"page" .
"sort" "title"
)}}
{{% /tab %}} {{< /tabs >}}
Parameter
Name | Default | Notes |
---|---|---|
containerstyle | ul |
Choose the style used to group all children. It could be any HTML tag name. |
style | li |
Choose the style used to display each descendant. It could be any HTML tag name. |
showhidden | false |
When true , child pages hidden from the menu will be displayed as well. |
description | false |
When true shows a short text under each page in the list. When no description or summary exists for the page, the first 70 words of the content is taken - read more info about summaries on gohugo.io. |
depth | 1 |
The depth of descendants to display. For example, if the value is 2 , the shortcode will display two levels of child pages. To get all descendants, set this value to a high number eg. 999 . |
sort | auto |
The sort criteria of the displayed list. - auto defaults to ordersectionsby of the page's {{% badge style="green" icon="fa-fw fab fa-markdown" title=" " %}}Front Matter{{% /badge %}}or to ordersectionsby of the configuration {{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}}or to weight - weight - title - linktitle - modifieddate - expirydate - publishdate - date - length - default adhering to Hugo's default sort criteria |
Examples
All Default
{{%/* children */%}}
{{% children %}}
With Description
{{%/* children description="true" */%}}
{{%children description="true" %}}
Infinite Depth and Hidden Pages
{{%/* children depth="999" showhidden="true" */%}}
{{% children depth="999" showhidden="true" %}}
Heading Styles for Container and Elements
{{%/* children containerstyle="div" style="h2" depth="3" description="true" */%}}
{{% children containerstyle="div" style="h2" depth="3" description="true" %}}
Divs for Group and Element Styles
{{%/* children containerstyle="div" style="div" depth="3" */%}}
{{% children containerstyle="div" style="div" depth="3" %}}