From 9e3a390cd4ca2ed78ad08de1f22f406d0cfb342c Mon Sep 17 00:00:00 2001 From: John Hollowell Date: Fri, 29 Jan 2021 17:59:51 -0500 Subject: [PATCH 1/5] Add year Replacement in RSS copyright Added the same replacement that happens in site-footer.html for the copyright to the RSS feed template --- layouts/_default/rss.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 18561d2..a4807db 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -13,7 +13,7 @@ {{.}}{{end}}{{ with $.Site.Params.email }} {{.}}{{ with $.Site.Params.myname }} ({{.}}){{end}}{{end}}{{ with .Site.Params.email }} {{.}}{{ with $.Site.Params.myname }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} - {{.}}{{end}}{{ if not .Date.IsZero }} + {{ replace . "{year}" now.Year | markdownify}}{{end}}{{ if not .Date.IsZero }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }}{{ with .Site.Params.updatePeriod }} {{.}}{{end}}{{ with .Site.Params.updateFrequency }} {{.}}{{end}} @@ -110,4 +110,4 @@ {{ end }} - \ No newline at end of file + From 049ea2af2e60da5f41ddea2beb073a3d244b94ee Mon Sep 17 00:00:00 2001 From: Svend WALTER Date: Tue, 23 Feb 2021 21:41:09 +0100 Subject: [PATCH 2/5] Update fr.toml --- i18n/fr.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/i18n/fr.toml b/i18n/fr.toml index d4cba9a..a3068e8 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -41,13 +41,13 @@ other = "RÉDIGÉ PAR" other = "Contenu" [counter-site-pv] -other = "Total views" +other = "Vues totales" [counter-site-uv] other = "visiteurs" [counter-page-pv] -other = "views" +other = "vues" [donate-message] other = "Soutenez l'auteur avec" @@ -83,7 +83,7 @@ other = "Accueil" other = "Rédigé le" [tooltip-modified] -other = "Modifié At" +other = "Modifié le" [tooltip-reading-time] other = "Temps de lecture" @@ -101,10 +101,10 @@ other = "Pour un rendu optimal, activez JavaScript" other = "MEILLEURES PUBLICATIONS" [skin-dark] -other = "dark" +other = "sombre" [skin-light] -other = "light" +other = "clair" [skin-hacker] other = "hacker" @@ -116,4 +116,4 @@ other = "solarized" other = "kimbie" [no-contents] -other = "Nothing to Display" \ No newline at end of file +other = "Rien à afficher" From 0037b4e19bcbf4961a15d2a94f88ae75acc23894 Mon Sep 17 00:00:00 2001 From: RheingoldRiver <18037011+RheingoldRiver@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:32:55 +0000 Subject: [PATCH 3/5] Support an rssDescription param --- layouts/_default/rss.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} {{ .Permalink }} - Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + {{ if .Site.Params.rssDescription }}{{ .Site.Params.rssDescription }}{{ else }}Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}{{ end }} Hugo -- gohugo.io{{ with .Site.Language.Lang }} {{.}}{{end}}{{ with $.Site.Params.email }} {{.}}{{ with $.Site.Params.myname }} ({{.}}){{end}}{{end}}{{ with .Site.Params.email }} From 272be8ac8836cbd1d595594497810ab8576719d9 Mon Sep 17 00:00:00 2001 From: zzossig Date: Tue, 20 Apr 2021 04:46:56 +0900 Subject: [PATCH 4/5] 2 more search options: searchContent, searchDistance --- README.ko.md | 8 ++++++-- exampleSite/config/_default/params.toml | 11 +++++++---- layouts/index.json | 6 +++++- layouts/partials/head/scripts.html | 9 +++++++-- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/README.ko.md b/README.ko.md index 9bb1ed2..6976b79 100644 --- a/README.ko.md +++ b/README.ko.md @@ -268,10 +268,14 @@ 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 + +# 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..99d6687 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -30,15 +30,18 @@ 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 + +# 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/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..cf2d608 100644 --- a/layouts/partials/head/scripts.html +++ b/layouts/partials/head/scripts.html @@ -662,6 +662,10 @@ {{ $enableSearch := ($.Param "enableSearch") }} var enableSearch = JSON.parse({{ $enableSearch | jsonify }}); + {{ $searchDistance := ($.Param "searchDistance") }} + var searchDistance = JSON.parse({{ $searchDistance | jsonify }}); + {{ $searchContent := ($.Param "searchContent") }} + var searchContent = JSON.parse({{ $searchContent | jsonify }}); {{ $enableSearchHighlight := ($.Param "enableSearchHighlight") }} var enableSearchHighlight = JSON.parse({{ $enableSearchHighlight | jsonify }}); {{ $searchResultPosition := ($.Param "searchResultPosition") }} @@ -686,12 +690,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) location: 0, // default: 0 - distance: 100, // default: 100 + distance: searchDistance ? searchDistance : 100, // default: 100 maxPatternLength: 32, minMatchCharLength: 1, isCaseSensitive: false, // defualt: false From 6258d4dde546706fcdb79f7d7060ee75a02a06ad Mon Sep 17 00:00:00 2001 From: zzossig Date: Wed, 21 Apr 2021 03:53:59 +0900 Subject: [PATCH 5/5] new param: searchThreshold --- README.ko.md | 1 + exampleSite/config/_default/params.toml | 1 + layouts/partials/head/scripts.html | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.ko.md b/README.ko.md index 6976b79..d05495e 100644 --- a/README.ko.md +++ b/README.ko.md @@ -273,6 +273,7 @@ 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 diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 99d6687..2d7b955 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -36,6 +36,7 @@ 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 diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html index cf2d608..3f0ba08 100644 --- a/layouts/partials/head/scripts.html +++ b/layouts/partials/head/scripts.html @@ -664,6 +664,8 @@ 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") }} @@ -694,7 +696,7 @@ 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: searchDistance ? searchDistance : 100, // default: 100 maxPatternLength: 32,