mirror of
https://github.com/hyzendust/hyzendust.github.io.git
synced 2026-09-19 02:23:17 +02:00
Fix: blank blog/categories links in search results
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -45,6 +45,7 @@
|
||||
}
|
||||
|
||||
function sectionLabel(section) {
|
||||
if (section === 'blog-category') return 'Category';
|
||||
if (section === 'blog') return 'Blog';
|
||||
if (section === 'services') return 'Service';
|
||||
return section;
|
||||
|
||||
@@ -21,10 +21,13 @@ Consumed client-side by /js/search.js.
|
||||
{{- $excluded = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not $excluded -}}
|
||||
{{- if and (not $excluded) (ne $permalink "") -}}
|
||||
{{- $pages = $pages | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- range site.Taxonomies.categories.Alphabetical -}}
|
||||
{{- $pages = $pages | append .Page -}}
|
||||
{{- end -}}
|
||||
[
|
||||
{{- range $i, $p := $pages -}}
|
||||
{{- if $i }},{{ end -}}
|
||||
@@ -34,10 +37,14 @@ Consumed client-side by /js/search.js.
|
||||
{{- $text := $clean | plainify | htmlUnescape -}}
|
||||
{{- $text = replaceRE `\s+` " " $text -}}
|
||||
{{- $text = strings.TrimSpace $text -}}
|
||||
{{- $section := cond (eq $p.Section "") "home" $p.Section -}}
|
||||
{{- if eq $p.Kind "term" -}}
|
||||
{{- $section = "blog-category" -}}
|
||||
{{- end -}}
|
||||
{
|
||||
"title": {{ $p.Title | jsonify }},
|
||||
"url": {{ $p.RelPermalink | jsonify }},
|
||||
"section": {{ (cond (eq $p.Section "") "home" $p.Section) | jsonify }},
|
||||
"section": {{ $section | jsonify }},
|
||||
"content": {{ $text | jsonify }}
|
||||
}
|
||||
{{- end -}}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
}
|
||||
|
||||
function sectionLabel(section) {
|
||||
if (section === 'blog-category') return 'Category';
|
||||
if (section === 'blog') return 'Blog';
|
||||
if (section === 'services') return 'Service';
|
||||
return section;
|
||||
|
||||
Reference in New Issue
Block a user