1.3 子页(children)


子页(children)简码列出了当前页面的子页面及其后代页面。

用法

{{% children sort="weight" %}}

参数

名称默认描述
containerstyleulChoose the style used to group all children. It could be any HTML tag name.
styleliChoose the style used to display each descendant. It could be any HTML tag name.
showhiddenfalseWhen true, child pages hidden from the menu will be displayed as well.
descriptionfalseWhen 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.
depth1The 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.
sortautoThe sort criteria of the displayed list.

- auto defaults to ordersectionsby of the pages frontmatter
    or to ordersectionsby of the site configuration
    or to weight
- weight
- title
- linktitle
- modifieddate
- expirydate
- publishdate
- date
- length
- default adhering to Hugo’s default sort criteria

案例

默认

{{% children  %}}

带描述

{{% children description="true" %}}

无限深度和隐藏页面

{{% children depth="999" showhidden="true" %}}

容器和元素的标题样式

{{% children containerstyle="div" style="h2" depth="3" description="true" %}}

子页 1

子页案例

子页 1-1

子页案例

子页 2

子页案例

Div: 组和元素样式

{{% children containerstyle="div" style="div" depth="3" %}}

子页(children) 的子部分

3.1 子页 1


这是子页案例!

子页 1 的子部分

1.1 子页 1-1


这是子页案例!

3.2 子页 2


这是子页案例!