mirror of https://github.com/docker/docs.git
hugo: return keywords as sliceArray
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
bbb894f3e4
commit
5599686cb9
|
@ -15,7 +15,15 @@ async function initializeIndex() {
|
||||||
keys: [
|
keys: [
|
||||||
{ name: "title", weight: 2 },
|
{ name: "title", weight: 2 },
|
||||||
{ name: "description", weight: 1 },
|
{ name: "description", weight: 1 },
|
||||||
{ name: "keywords", weight: 1 },
|
{
|
||||||
|
name: "keywords",
|
||||||
|
weight: 1,
|
||||||
|
getFn: (page) => {
|
||||||
|
return Array.isArray(page.keywords)
|
||||||
|
? page.keywords.join(" ")
|
||||||
|
: page.keywords;
|
||||||
|
},
|
||||||
|
},
|
||||||
{ name: "tags", weight: 1 },
|
{ name: "tags", weight: 1 },
|
||||||
],
|
],
|
||||||
minMatchCharLength: 1,
|
minMatchCharLength: 1,
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<meta name="description" content="{{ $description }}" />
|
<meta name="description" content="{{ $description }}" />
|
||||||
<meta
|
<meta
|
||||||
name="keywords"
|
name="keywords"
|
||||||
content="{{- partial "utils/keywords.html" . -}}"
|
content="{{- delimit (partialCached "utils/keywords.html" . .) ", " -}}"
|
||||||
/>
|
/>
|
||||||
<link rel="canonical" href="{{ .Permalink }}" />
|
<link rel="canonical" href="{{ .Permalink }}" />
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{{ $keywords := "" }}
|
{{ $keywords := "" }}
|
||||||
{{ if .Keywords }}
|
{{ if .Keywords }}
|
||||||
{{ $keywords = delimit .Keywords " " }}
|
{{ $keywords = collections.Apply .Keywords "strings.Trim" "." ", " }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ with .File }}
|
{{ with .File }}
|
||||||
{{ with (index (site.Data.frontmatter) .Path) }}
|
{{ with (index (site.Data.frontmatter) .Path) }}
|
||||||
{{ with .keywords }}
|
{{ with .keywords }}
|
||||||
{{ $keywords = strings.Replace (strings.Trim . "\n") "\n" " " }}
|
{{ $keywords = collections.Apply (strings.Split (strings.Replace . "\n" " ") ",") "strings.Trim" "." " " }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in New Issue