Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zzossig/hugo-theme-zzo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.ko.md9
-rw-r--r--exampleSite/config/_default/params.toml12
-rw-r--r--layouts/_default/rss.xml2
-rw-r--r--layouts/index.json6
-rw-r--r--layouts/partials/head/scripts.html13
5 files changed, 31 insertions, 11 deletions
diff --git a/README.ko.md b/README.ko.md
index 9bb1ed2..d05495e 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -268,10 +268,15 @@ showMobileMenuTerms = ["tags", "categories", "series"]
# navbar
enableThemeChange = true # site color theme
-# body
-enableBreadcrumb = true # breadcrumb for list, single page
+# search
enableSearch = true # site search with fuse
enableSearchHighlight = true # when true, search keyword will be highlighted
+searchContent = true # include content to search index
+searchDistance = 100 # fuse option: distance
+searchThreshold = 0.4 # 0.0: exact match, 1.0: any match
+
+# body
+enableBreadcrumb = true # breadcrumb for list, single page
enableGoToTop = true # scroll to top
enableWhoami = true # at the end of single page
summaryShape = "classic" # card, classic, compact
diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml
index 08dd35e..2d7b955 100644
--- a/exampleSite/config/_default/params.toml
+++ b/exampleSite/config/_default/params.toml
@@ -30,15 +30,19 @@ hideHomeHeaderWhenMobile = false
# menu
showMobileMenuTerms = ["tags", "categories", "series"]
-# body
-enableBreadcrumb = true
-enablePhotoSwipe = true
+# search
enableSearch = true
enableSearchHighlight = true
+searchResultPosition = "main" # side, main
+searchContent = true # include content to search index
+searchDistance = 100 # fuse option
+searchThreshold = 0.4 # 0.0: exact match, 1.0: any match
+
+# body
+enableBreadcrumb = true
enableGoToTop = true
enableWhoami = true
summaryShape = "classic" # card, classic, compact
-searchResultPosition = "main" # side, main
archiveGroupByDate = "2006" # "2006-01": group by month, "2006": group by year
archivePaginate = 13
paginateWindow = 1
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index 18561d2..8f5e168 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -8,7 +8,7 @@
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
- <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
+ <description>{{ if .Site.Params.rssDescription }}{{ .Site.Params.rssDescription }}{{ else }}Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}{{ end }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.Language.Lang }}
<language>{{.}}</language>{{end}}{{ with $.Site.Params.email }}
<managingEditor>{{.}}{{ with $.Site.Params.myname }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Params.email }}
diff --git a/layouts/index.json b/layouts/index.json
index 98a3da9..d2ba08a 100644
--- a/layouts/index.json
+++ b/layouts/index.json
@@ -2,7 +2,11 @@
{{- $.Scratch.Add "searchindex" slice -}}
{{- range $index, $element := (where .Site.RegularPages "Kind" "page") -}}
{{ with $element.Plain }}
- {{- $.Scratch.Add "searchindex" (dict "id" $index "title" $element.Title "uri" $element.Permalink "tags" $element.Params.tags "section" $element.Section "content" $element.Plain "description" $element.Description) -}}
+ {{- if $.Param "searchContent" -}}
+ {{- $.Scratch.Add "searchindex" (dict "id" $index "title" $element.Title "uri" $element.Permalink "tags" $element.Params.tags "section" $element.Section "content" $element.Plain "description" $element.Description) -}}
+ {{ else }}
+ {{- $.Scratch.Add "searchindex" (dict "id" $index "title" $element.Title "uri" $element.Permalink "tags" $element.Params.tags "section" $element.Section "description" $element.Description) -}}
+ {{- end -}}
{{ end }}
{{- end -}}
{{- $.Scratch.Get "searchindex" | jsonify -}} \ No newline at end of file
diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html
index ec2514f..3f0ba08 100644
--- a/layouts/partials/head/scripts.html
+++ b/layouts/partials/head/scripts.html
@@ -662,6 +662,12 @@
{{ $enableSearch := ($.Param "enableSearch") }}
var enableSearch = JSON.parse({{ $enableSearch | jsonify }});
+ {{ $searchDistance := ($.Param "searchDistance") }}
+ var searchDistance = JSON.parse({{ $searchDistance | jsonify }});
+ {{ $searchThreshold := ($.Param "searchThreshold") }}
+ var searchThreshold = JSON.parse({{ $searchThreshold | jsonify }});
+ {{ $searchContent := ($.Param "searchContent") }}
+ var searchContent = JSON.parse({{ $searchContent | jsonify }});
{{ $enableSearchHighlight := ($.Param "enableSearchHighlight") }}
var enableSearchHighlight = JSON.parse({{ $enableSearchHighlight | jsonify }});
{{ $searchResultPosition := ($.Param "searchResultPosition") }}
@@ -686,12 +692,13 @@
xhr.onload = function () {
if (xhr.status === 200) {
fuse = new Fuse(JSON.parse(xhr.response.toString('utf-8')), {
- keys: sectionType.includes('publication') ? ['title', 'abstract'] : ['title', 'description', 'content'],
+ keys: sectionType.includes('publication') ? ['title', 'abstract'] :
+ searchContent ? ['title', 'description', 'content'] : ['title', 'description'],
includeMatches: enableSearchHighlight,
shouldSort: true, // default: true
- threshold: 0.4, // default: 0.6 (0.0 requires a perfect match)
+ threshold: searchThreshold ? searchThreshold : 0.4, // default: 0.6 (0.0 requires a perfect match)
location: 0, // default: 0
- distance: 100, // default: 100
+ distance: searchDistance ? searchDistance : 100, // default: 100
maxPatternLength: 32,
minMatchCharLength: 1,
isCaseSensitive: false, // defualt: false