diff --git a/exampleSite/content/en/shortcodes/toc-tree.md b/exampleSite/content/en/shortcodes/toc-tree.md index 27de09e..e0b4e25 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 -{{}} +{{}} ``` +### 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 0000000..8122126 --- /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 13148ba..4c81b5b 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 }}
- {{ template "toc-tree" dict "sect" .Page.Pages }} + {{ template "toc-tree" dict "sect" .Page.Pages "current" $current "sortBy" $sortBy }}
{{- end }} @@ -10,8 +12,36 @@ {{- define "toc-tree" }}