feat: add flexsearch
This commit is contained in:
@ -4,12 +4,13 @@
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Organization",
|
||||
"url": "{{ .Site.BaseURL }}",
|
||||
"url": "{{ "/" | absURL }}",
|
||||
"name": "{{ .Site.Params.title }}",
|
||||
"logo": "{{ .Site.BaseURL }}{{ .Site.Params.schemaLogo }}",
|
||||
"logo": "{{ "/" | absURL }}{{ .Site.Params.schemaLogo }}",
|
||||
"sameAs": [
|
||||
"{{ .Site.Params.schemaTwitter | safeURL }}",
|
||||
"{{ .Site.Params.schemaLinkedIn | safeURL }}"
|
||||
"{{ .Site.Params.schemaLinkedIn | safeURL }}",
|
||||
"{{ .Site.Params.schemaGitHub | safeURL }}"
|
||||
]
|
||||
}
|
||||
</script>
|
||||
@ -19,11 +20,12 @@
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Person",
|
||||
"url": "{{ .Site.BaseURL }}",
|
||||
"url": "{{ "/" | absURL }}",
|
||||
"name": "{{ .Site.Params.title }}",
|
||||
"sameAs": [
|
||||
"{{ .Site.Params.schemaTwitter | safeURL }}",
|
||||
"{{ .Site.Params.schemaLinkedIn | safeURL }}"
|
||||
"{{ .Site.Params.schemaLinkedIn | safeURL }}",
|
||||
"{{ .Site.Params.schemaGitHub | safeURL }}"
|
||||
]
|
||||
}
|
||||
</script>
|
||||
@ -33,10 +35,10 @@
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebSite",
|
||||
"url": "{{ .Site.BaseURL }}",
|
||||
"url": "{{ "/" | absURL }}",
|
||||
"potentialAction": {
|
||||
"@type": "SearchAction",
|
||||
"target": "{{ .Site.BaseURL }}?q={search_term_string}",
|
||||
"target": "{{ "/" | absURL }}?q={search_term_string}",
|
||||
"query-input": "required name=search_term_string"
|
||||
}
|
||||
}
|
||||
@ -54,7 +56,7 @@
|
||||
"@id": "{{ .Permalink }}"
|
||||
},
|
||||
"headline": "{{ .Title }}",
|
||||
"image": {{ apply .Params.images "absURL" "." }},
|
||||
"image": [{{ range $i, $e := .Params.images }}{{ if $i }}, {{ end }}{{ printf "%s%s" $.Permalink $e }}{{ end }}],
|
||||
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05CET" }}",
|
||||
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05CET" }}",
|
||||
"author": {
|
||||
@ -67,7 +69,7 @@
|
||||
{{ if eq .Site.Params.schemaType "Organization" -}}
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ .Site.BaseURL }}{{ .Site.Params.schemaLogo }}"
|
||||
"url": "{{ "/" | absURL }}{{ .Site.Params.schemaLogo }}"
|
||||
}
|
||||
{{ end -}}
|
||||
},
|
||||
@ -77,16 +79,20 @@
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ $dot := . -}}
|
||||
{{ $dot.Scratch.Set "path" "" -}}
|
||||
{{ $dot.Scratch.Set "breadcrumb" slice -}}
|
||||
|
||||
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" -}}
|
||||
{{ $.Scratch.Add "path" .Site.BaseURL -}}
|
||||
|
||||
{{ $.Scratch.Add "breadcrumb" (slice (dict "url" .Site.BaseURL "name" "home" "position" 1 )) -}}
|
||||
{{ range $index, $element := split $url "/" -}}
|
||||
{{ $.Scratch.Add "path" $element -}}
|
||||
{{ $.Scratch.Add "path" "/" -}}
|
||||
{{ range $index, $element := split $url "/" -}}
|
||||
{{ $dot.Scratch.Add "path" $element -}}
|
||||
{{ $.Scratch.Add "path" "/" -}}
|
||||
{{ if ne $element "" -}}
|
||||
{{ $.Scratch.Add "breadcrumb" (slice (dict "url" ($.Scratch.Get "path") "name" . "position" (add $index 2))) -}}
|
||||
{{ end -}}
|
||||
{{ $.Scratch.Add "breadcrumb" (slice (dict "url" ($.Scratch.Get "path") "name" . "position" (add $index 2))) -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
<script type="application/ld+json">
|
||||
@ -96,10 +102,8 @@
|
||||
"itemListElement": [{{ range $.Scratch.Get "breadcrumb" }}{{ if ne .position 1 }},{{ end }}{
|
||||
"@type": "ListItem",
|
||||
"position": {{ .position }},
|
||||
"item": {
|
||||
"@id": "{{ .url }}",
|
||||
"name": "{{ .name }}"
|
||||
}
|
||||
"name": "{{ .name | humanize | title }}",
|
||||
"item": "{{ .url }}"
|
||||
}{{ end }}]
|
||||
}
|
||||
</script>
|
||||
</script>
|
Reference in New Issue
Block a user