Skip to content

子页面列表

list_children 短代码用于显示当前页面的子页面列表,默认使用最简单的无样式列表格式。

基本用法

{{< list_children >}}

默认显示为简单的 HTML 列表,不添加任何 CSS 类或样式。

参数说明

show_summary

  • 类型: boolean
  • 默认值: true
  • 说明: 是否显示页面摘要或描述
{{< list_children show_summary="false" >}}

show_weight

  • 类型: boolean
  • 默认值: false
  • 说明: 是否显示页面权重编号
{{< list_children show_weight="true" >}}

show_date

  • 类型: boolean
  • 默认值: false
  • 说明: 是否显示页面日期
{{< list_children show_date="true" >}}

style

  • 类型: string
  • 默认值: "list"
  • 可选值: "list", "cards"
  • 说明: 显示样式
{{< list_children style="cards" >}}  {{< !-- 使用卡片样式 --}}
{{< list_children style="list" >}}   {{< !-- 使用列表样式(默认) --}}

limit

  • 类型: integer
  • 默认值: 无限制
  • 说明: 限制显示的子页面数量
{{< list_children limit="5" >}}

title

  • 类型: string
  • 默认值: "Table of content"
  • 说明: 设置显示的标题内容,默认显示为 "Table of content"。
{{< list_children title="自定义标题" >}}

完整示例

简单列表(默认,推荐)

{{< list_children >}}
{{< list_children show_summary="true" >}}
{{< list_children show_weight="true" show_summary="true" >}}

带日期的列表

{{< list_children show_date="true" show_summary="true" >}}

卡片样式

{{< list_children style="cards" show_summary="true" >}}

输出格式

列表样式(默认)

生成标准的 HTML 无序列表:

<ul>
  <li>1. <a href="/path/">页面标题</a> <small>(2025-06-21)</small>
    <br><small>页面描述内容</small>
  </li>
</ul>

卡片样式(增强视觉效果)

生成带 CSS 类的卡片结构(需要相应的 CSS 样式支持)。

设计原则

  1. 简洁至上: 默认不添加任何 CSS 类,使用原生 HTML 列表
  2. 无样式依赖: 基础功能不依赖任何外部样式文件
  3. 渐进增强: 可选择使用卡片样式获得更丰富的视觉效果
  4. 语义化: 使用正确的 HTML 标签结构

Front Matter 要求

---
title: "页面标题"
description: "页面描述(优先显示)"
weight: 10  # 用于排序和编号显示
date: 2025-06-21  # 可选显示
---