mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-26 17:23:05 +00:00
children: use LinkTitle instead of Title #939
This commit is contained in:
parent
41a1e95d1e
commit
8da8ed8614
5 changed files with 13 additions and 9 deletions
|
@ -24,6 +24,12 @@ weight = -1
|
|||
|
||||
You don't need to change anything in your existing installation as the old configuration is used as a default.
|
||||
|
||||
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The [`children` shortcode](shortcodes/children) was changed to output a page's _LinkTitle_ instead of previously using the _Title_.
|
||||
|
||||
As the shortcode always outputs subpages in context of the parent page, it functions similar to the sidebar menu. The sidebar menu itself uses the _LinkTitle_ for naming the menu entries and so should the shortcode do.
|
||||
|
||||
The parameter value `sort=linktitle` was deprecated for the easier `sort=title`. You can still use the old value but both behave the same way in sorting by _LinkTitle_.
|
||||
|
||||
### New
|
||||
|
||||
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Menus created by your page structure are now able to [contain arbitrary links](configuration/sidebar/menus#displaying-arbitrary-links-in-a-page-menu) inserted into the structure using the `menuUrl` or `menuPageRef` front matter.
|
||||
|
|
|
@ -42,7 +42,7 @@ The `children` shortcode lists the child pages of the current page and its desce
|
|||
| **showhidden** | `false` | When `true`, child pages hidden from the menu will be displayed as well. |
|
||||
| **description** | `false` | When `true` shows a short text under each page in the list. When no description or summary exists for the page, the first 70 words of the content is taken - [read more info about summaries on gohugo.io](https://gohugo.io/content/summaries/). |
|
||||
| **depth** | `1` | The depth of descendants to display. For example, if the value is `2`, the shortcode will display two levels of child pages. To get all descendants, set this value to a high number eg. `999`. |
|
||||
| **sort** | `auto` | The sort criteria of the displayed list.<br><br>- `auto` defaults to `ordersectionsby` of the page's {{% badge style="green" icon="fa-fw fab fa-markdown" title=" " %}}Front Matter{{% /badge %}}<br> or to `ordersectionsby` of the configuration {{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}}<br> or to `weight`<br>- `weight`<br>- `title`<br>- `linktitle`<br>- `modifieddate`<br>- `expirydate`<br>- `publishdate`<br>- `date`<br>- `length`<br>- `default` adhering to Hugo's default sort criteria|
|
||||
| **sort** | `auto` | The sort criteria of the displayed list.<br><br>- `auto` defaults to `ordersectionsby` of the page's {{% badge style="green" icon="fa-fw fab fa-markdown" title=" " %}}Front Matter{{% /badge %}}<br> or to `ordersectionsby` of the configuration {{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}}<br> or to `weight`<br>- `weight`<br>- `title`<br>- `modifieddate`<br>- `expirydate`<br>- `publishdate`<br>- `date`<br>- `length`<br>- `default` adhering to Hugo's default sort criteria|
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
|
||||
{{- if eq $by "weight" }}
|
||||
{{- $pages = $page.Pages.ByWeight }}
|
||||
{{- else if or (eq $by "name") (eq $by "title") }}
|
||||
{{- $pages = $page.Pages.ByTitle }}
|
||||
{{- else if eq $by "linktitle" }}
|
||||
{{- else if or (eq $by "name") (eq $by "title") (eq $by "linktitle") }}
|
||||
{{- $pages = $page.Pages.ByLinkTitle }}
|
||||
{{- else if eq $by "modifieddate" }}
|
||||
{{- $pages = $page.Pages.Lastmod }}
|
||||
|
|
|
@ -35,12 +35,12 @@
|
|||
{{- if hasPrefix $.style "h" }}
|
||||
{{- $num := sub ( int (trim $.style "h") ) 1 }}
|
||||
{{- $numn := add $num $.count }}
|
||||
{{ (printf " <h%d>" $numn)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</h%d>" $numn)|safeHTML }}
|
||||
{{ (printf " <h%d>" $numn)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}{{ (printf "</h%d>" $numn)|safeHTML }}
|
||||
{{- else if eq $.style "li" }}
|
||||
{{ (printf " <%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}
|
||||
{{ (printf " <%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}
|
||||
{{- else }}
|
||||
{{ (printf " <%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</%s>" $.style)|safeHTML }}
|
||||
{{- end }}
|
||||
{{ (printf " <%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}{{ (printf "</%s>" $.style)|safeHTML }}
|
||||
.LinkTitle{{- end }}
|
||||
{{- if $.description }}
|
||||
{{- with or .Description .Summary -}}
|
||||
<p>{{ . }}</p>
|
||||
|
|
|
@ -1 +1 @@
|
|||
7.0.1+10fb679d67466ad0b5f5563c6892220a7a95eb21
|
||||
7.0.1+41a1e95d1eb3169d1238a078b0f2f0cf2f6246d6
|
Loading…
Reference in a new issue