mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
tags: improve search index for tags #531
This commit is contained in:
parent
4076eab670
commit
98cc7904ab
2 changed files with 33 additions and 7 deletions
|
@ -1,8 +1,21 @@
|
||||||
{{- partialCached "page-meta.hugo" . .RelPermalink }}
|
{{- partialCached "page-meta.hugo" . .RelPermalink }}
|
||||||
{{- $pages := slice }}
|
{{- $pages := slice }}
|
||||||
{{- range .Site.Pages }}
|
{{- range .Site.Pages }}
|
||||||
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
|
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
|
||||||
{{- $pages = $pages | append (dict "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) "title" .Title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }}
|
{{- $title := .Title }}
|
||||||
{{- end }}
|
{{- if eq .Kind "taxonomy" }}
|
||||||
{{- end }}
|
{{- $title = i18n .Data.Plural }}
|
||||||
|
{{- if not $title }}
|
||||||
|
{{- $title = .Data.Plural | humanize }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if eq .Kind "term" }}
|
||||||
|
{{- $title = i18n .Data.Singular }}
|
||||||
|
{{- if not $title }}
|
||||||
|
{{- $title = .Data.Singular | humanize }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (.Title | humanize) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $pages = $pages | append (dict "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) "title" $title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
{{- $pages | jsonify (dict "indent" " ") }}
|
{{- $pages | jsonify (dict "indent" " ") }}
|
||||||
|
|
|
@ -1,8 +1,21 @@
|
||||||
{{- partialCached "page-meta.hugo" . .RelPermalink }}
|
{{- partialCached "page-meta.hugo" . .RelPermalink }}
|
||||||
{{- $pages := slice }}
|
{{- $pages := slice }}
|
||||||
{{- range .Site.Pages }}
|
{{- range .Site.Pages }}
|
||||||
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
|
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
|
||||||
{{- $pages = $pages | append (dict "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) "title" .Title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }}
|
{{- $title := .Title }}
|
||||||
{{- end }}
|
{{- if eq .Kind "taxonomy" }}
|
||||||
|
{{- $title = i18n .Data.Plural }}
|
||||||
|
{{- if not $title }}
|
||||||
|
{{- $title = .Data.Plural | humanize }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if eq .Kind "term" }}
|
||||||
|
{{- $title = i18n .Data.Singular }}
|
||||||
|
{{- if not $title }}
|
||||||
|
{{- $title = .Data.Singular | humanize }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (.Title | humanize) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $pages = $pages | append (dict "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) "title" $title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }}
|
||||||
|
{{- end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
var relearn_search_index = {{ $pages | jsonify (dict "indent" " ") }}
|
var relearn_search_index = {{ $pages | jsonify (dict "indent" " ") }}
|
||||||
|
|
Loading…
Reference in a new issue