mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-30 03:03:09 +00:00
taxonomy: fix sorting of terms on content pages #710
This commit is contained in:
parent
ec482bb3de
commit
4ebb6d9eac
1 changed files with 11 additions and 10 deletions
|
@ -13,19 +13,20 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $taxonomy_page := $page.Site.GetPage $taxonomy }}
|
{{- $taxonomy_page := $page.Site.GetPage $taxonomy }}
|
||||||
{{- $terms := slice | append (index $page.Params $taxonomy) }}
|
{{- $terms := slice | append (index $page.Params $taxonomy) }}
|
||||||
{{- $term_pages := dict }}
|
{{- $term_pages := slice }}
|
||||||
{{- range sort $terms }}
|
{{- range $terms }}
|
||||||
{{- $term := trim . " " }}
|
{{- $term := trim . " " }}
|
||||||
{{- if not $term }}
|
{{- if not $term }}
|
||||||
{{- continue }}
|
{{- continue }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $term_key := ($term | plainify | anchorize) }}
|
{{- $term_key := ($term | plainify | anchorize) }}
|
||||||
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
||||||
{{- $term_pages = $term_pages | merge (dict $term_key .) }}
|
{{- $term_pages = $term_pages | append (dict "Title" (default .Data.Term .Title) "Term" . )}}
|
||||||
{{- end }}
|
{{- else }}
|
||||||
{{- $term_key = ($term | urlize) }}
|
{{- $term_key = ($term | urlize) }}
|
||||||
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
||||||
{{- $term_pages = $term_pages | merge (dict $term_key .) }}
|
{{- $term_pages = $term_pages | append (dict "Title" (default .Data.Term .Title) "Term" . )}}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with $term_pages }}
|
{{- with $term_pages }}
|
||||||
|
@ -34,9 +35,9 @@
|
||||||
<i class="{{ $icon }}"></i>
|
<i class="{{ $icon }}"></i>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<ul>
|
<ul>
|
||||||
{{- range $term_page := . }}
|
{{- range sort . ".Title" }}
|
||||||
{{- $to := . }}
|
{{- $to := .Term }}
|
||||||
<li><a class="term-link" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{ default $to.Data.Term $to.Title }}</a></li>
|
<li><a class="term-link" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{ .Title }}</a></li>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue