Google Recaptcha parameter added.
This commit is contained in:
parent
438cc9561c
commit
9100452769
|
@ -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
|
||||
|
@ -93,6 +97,7 @@ enableThemeChange = true
|
|||
|
||||
# service
|
||||
googleTagManager = "" # GTM-XXXXXX
|
||||
googleRecaptcha = "" #add your site key here example "6LesNi8aAAAAAGfQ6mXSkFJIVTpDpywrUUHTdx87"
|
||||
baiduAnalytics = ""
|
||||
enableBusuanzi = false
|
||||
busuanziSiteUV = true
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -8,12 +8,12 @@
|
|||
<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 }}
|
||||
<webMaster>{{.}}{{ with $.Site.Params.myname }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<copyright>{{ replace . "{year}" now.Year | markdownify}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}{{ with .Site.Params.updatePeriod }}
|
||||
<sy:updatePeriod>{{.}}</sy:updatePeriod>{{end}}{{ with .Site.Params.updateFrequency }}
|
||||
<sy:updateFrequency>{{.}}</sy:updateFrequency>{{end}}
|
||||
|
|
|
@ -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 -}}
|
|
@ -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
|
||||
|
@ -715,7 +722,7 @@
|
|||
var a = document.createElement('a');
|
||||
a.innerHTML = obj.item.title;
|
||||
a.setAttribute('class', 'search-result__item--title');
|
||||
a.setAttribute('href', obj.item.permalink);
|
||||
a.setAttribute('href', obj.item.uri);
|
||||
|
||||
var descDiv = document.createElement('div');
|
||||
descDiv.setAttribute('class', 'search-result__item--desc');
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{{ partial "service/google-analytics" . }}
|
||||
{{ partial "service/google-recaptcha" . }}
|
||||
{{ partial "service/google-tag-manager" . }}
|
||||
{{ partial "service/baidu-analytics" . }}
|
||||
{{ partial "service/busuanzi" . }}
|
|
@ -0,0 +1,3 @@
|
|||
{{ if $.Site.Params.googleRecaptcha }}
|
||||
<script src="https://www.google.com/recaptcha/api.js?render={{ $.Site.Params.googleRecaptcha }}"></script>
|
||||
{{ end }}
|
Loading…
Reference in New Issue