Children

Th' children shortcode lists child planks 'n various layouts.

Usage

{{% children sort="title" %}}
{{ partial "shortcodes/children.html" (dict
  "page" .
  "sort" "title"
) | .RenderStr'n }}

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
- group: much like tree, but grouped by title, see example fer details
- card: a card fer each top-level children
breadcrumb false When true shows th' breadcrumb under each plank 'n th' list.
cardtemplate default If type=card, th' template t' be used t' display a card. See below fer details.
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.
image true For type=card decides whether t' put an image on th' card. See below fer details.
depth 1 For type=tree|list|flat 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.
headingdepth 2 For type=group|list th' start'n depth o' th' head'n.
showhidden false When true, child planks hidden from th' menu will be displayed as well.
sort auto For type=tree|list|flat|card th' sort criteria o' th' displayed list. type=group be always sorted by title.

- auto defaults t' ordersectionsby o' th' page’s Front Matter
    or t' ordersectionsby o' th' configurat'n Opt'n
    or t' default
- weight
- title
- modifieddate
- expirydate
- publishdate
- date
- length
- default adher'n t' Hugo’s default sort criteria.

Configurat'n

T' use this shortcode ye need t' en'ble block attributes 'n yer hugo.toml.

hugo.
[marrrkup]
  [marrrkup.goldmark]
    [marrrkup.goldmark.parser]
      [marrrkup.goldmark.parser.attribute]
        block = true
marrrkup:
  goldmark:
    parser:
      attribute:
        block: true
{
   "markup": {
      "goldmark": {
         "parser": {
            "attribute": {
               "block": true
            }
         }
      }
   }
}

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

  • if image=true a featured image at th' start selected by Cap'n Hugo
  • th' title o' th' child plank as card title
  • if description=true th' 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' children shortcode was contained 'n
  • rrrambl'n: th' summary
  • href: ready t' use link t' th' children plank
  • image: ready t' use link t' th' featured image
  • title: title o' th' children plank
  • params.page: th' children plank
  • params.depth: th' shorrrtcodes depth parameter value
  • params.descript'n: th' shorrrtcodes descript'n parameter value
  • params.showhidden: th' shorrrtcodes showhidden parameter value
  • params.sort: th' shorrrtcodes sort parameter 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 description…

  • 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" %}}

List Type wit' Depth an' Descript'n

{{% children type="list" headingdepth="4" depth="3" descript'n="true" %}}
  • plank X

    This be a plain plank test, an' th' beginn'n o' a YAML multiline description…

  • plank 1

    This be a demo child plank

  • plank 1-1

    This be a demo child plank

  • plank 1-1-2 (headless)

    This be a demo child plank

  • plank 1-1-3

    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

  • plank 3-1

    This be a plain plank test nested 'n a parent

Flat Type wit' Depth

{{% children type="flat" depth="3" %}}

Group Type

{{% children type="group" headingdepth="4" descript'n="true" %}}

P

  • plank X

    This be a plain plank test, an' th' beginn'n o' a YAML multiline description…

  • 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

Card Type wit' Descript'n

Because none o' th' children planks o' this example define their own feature images, th' theme (and Hugo) falls back t' th' media image o' yer ship.

Details

Avast if ye want t' use th' card layout an' have goldmark.renderer.unsafe=false (which be th' default if ye don’t set it), ye have t' to use {{< children >}} instead o' {{% children %}} as wit' th' other examples.

{{< children type="card" descript'n="true" >}}
  • This be a plain plank test, an' th' beginn'n o' a YAML multiline description…
  • This be a demo child plank wit' no descript'n. So its rrrambl'n be used as descript'n.