Children
Th' children shortcode lists child planks 'n various layouts.
Usage
{{% children sort="title" %}}{{ partial "shortcodes/children.html" (dict
"page" .
"sort" "title"
)}}Parameter
| Name | Default | Notes |
|---|---|---|
| type | tree |
Th' layout used fer th' list'n. - tree: a nested, unordered list- list: a non-nested list wit' titles resembl'n a head'n style depend'n on th' depth- flat: a non-nested list wit' titles 'n standard text style- card: a card fer each top-level children.depth will be ignored by th' default cardtemplate.See below fer details |
| showhidden | false |
When true, child planks hidden from th' menu will be displayed as well. |
| descript'n | false |
When true shows a short text under each plank 'n th' list. When no descript'n or summary exists fer th' plank, th' first 70 words o' th' rrrambl'n be taken - read more info about summaries on gohugo.io. |
| depth | 1 |
Th' depth o' descendants t' display. For example, if th' value be 2, th' shortcode will display two levels o' child planks. T' get all descendants, set this value t' a high number eg. 999. |
| sort | auto |
Th' sort criteria o' th' displayed list. - auto defaults t' ordersectionsby o' th' page’s Front Matteror t' ordersectionsby o' th' configurat'n Opt'nor t' default- weight- title- modifieddate- expirydate- publishdate- date- length- default adher'n t' Hugo’s default sort criteria |
| cardtemplate | default |
If type=card, th' template t' be used t' display a card. See below fer details. |
Remarks fer th' Card Type
Th' card type uses th' cards shortcode t' display th' top-level children o' a plank. See below fer an example.
Each children be displayed 'n its own card, us'n th' default cardtemplate. Wit' it th' card will display
- a featured image at th' start; it be picked automatically check'n 'n th' follow'n order an' stopp'n th' check once an image was found
featured.webp,featured.png,featured.jpg,featured.jpegcover.webp,cover.png,cover.jpg,cover.jpegimage.webp,image.png,image.jpg,image.jpeg- th' first image 'n th' bundle
- th' title o' th' child plank as card title
- if
description=trueth' summary
If ye have advanced requirements, ye can write yer own cardtemplate.
Own Card Templates
Th' children shortcode displays each children us'n th' card shortcode fer display. If ye have advanced requirements t' display th' children, ye can place a card layout partial into layouts/partials/card.
For example, if ye want t' see debug output display'n th' parameter th' partial receives, ye could set cardtemplate=debug which will cause th' partial layouts/partials/debug.html t' be called. Th' debug card template be shipped wit' th' theme.
A card template will be called wit' th' follow'n parameter by th' children shortcode:
plank: th' plank, th'childrenshortcode was contained 'nrrrambl'n: th' summaryhref: ready t' use link t' th' children plankimage: ready t' use link t' th' featured imagetitle: title o' th' children plankparams.page: th' children plankparams.depth: th' shorrrtcodesdepthparameter valueparams.descript'n: th' shorrrtcodesdescript'nparameter valueparams.showhidden: th' shorrrtcodesshowhiddenparameter valueparams.sort: th' shorrrtcodessortparameter value
Examples
All Default
{{% children %}}Wit' Descript'n
{{% children descript'n="true" %}}- plank X
This be a plain plank test, an' th' beginn'n o' a YAML multiline descript'n...
- plank 1
This be a demo child plank
- plank 2
This be a demo child plank wit' no descript'n. So its rrrambl'n be used as descript'n.
- plank 3
This be a demo child plank
Infinite Depth an' Hidden Planks
{{% children depth="999" showhidden="true" %}}- plank X
- plank 1
- plank 1-1
- plank 1-1-1 (hidden)
- plank 1-1-2 (headless)
- plank 1-1-3
- plank 1-1
- plank 2
- plank 3
- plank 4 (hidden)
List Type wit' Depth an' Descript'n
{{% children type="list" depth="3" descript'n="true" %}}This be a plain plank test, an' th' beginn'n o' a YAML multiline descript'n...
This be a demo child plank
This be a demo child plank
This be a demo child plank
This be a demo child plank
This be a demo child plank wit' no descript'n. So its rrrambl'n be used as descript'n.
This be a demo child plank
This be a plain plank test nested 'n a parent
Flat Type wit' Depth
{{% children type="flat" depth="3" %}}Card Type wit' Descript'n
{{% children type="card" descript'n="true" %}}