diff --git a/exampleSite/content/en/shortcodes/toc-tree.md b/exampleSite/content/en/shortcodes/toc-tree.md index 27de09ed..e0b4e253 100644 --- a/exampleSite/content/en/shortcodes/toc-tree.md +++ b/exampleSite/content/en/shortcodes/toc-tree.md @@ -8,10 +8,18 @@ The `toc-tree` shortcode will generate a Table of Content from a section file tr ```tpl -{{* toc-tree */>}} +{{* toc-tree [sortBy="title"] */>}} ``` +### Attributes + + + +{{< propertylist name=shortcode-toc-tree sort=name order=asc >}} + + + ## Example As said, the root will be the site on which the shortcode was used, you can see a demo including nesting in the [ToC Tree](/toc-tree/) section. diff --git a/exampleSite/data/properties/shortcode-toc-tree.yaml b/exampleSite/data/properties/shortcode-toc-tree.yaml new file mode 100644 index 00000000..8122126c --- /dev/null +++ b/exampleSite/data/properties/shortcode-toc-tree.yaml @@ -0,0 +1,8 @@ +--- +properties: + - name: sortBy + type: string + description: | + Override the default sort parameter set by [`geekdocFileTreeSortBy`](/usage/configuration/#site-configuration). + required: false + defaultValue: .Site.Params.geekdocFileTreeSortBy diff --git a/layouts/shortcodes/toc-tree.html b/layouts/shortcodes/toc-tree.html index 13148ba1..4c81b5b5 100644 --- a/layouts/shortcodes/toc-tree.html +++ b/layouts/shortcodes/toc-tree.html @@ -1,8 +1,10 @@ +{{- $current := . }} {{- $tocLevels := default (default 6 .Site.Params.geekdocToC) .Page.Params.geekdocToC }} +{{- $sortBy := (default (default "title" .Site.Params.geekdocFileTreeSortBy) (.Get "sortBy") | lower) }} {{- if $tocLevels }}