diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-07-31 16:52:44 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-07-31 16:52:44 +0200 |
| commit | 7ca5f7f20a14d4a2ad0e386d018bccacfa9000dc (patch) | |
| tree | 490ca3166f76eccfdf06b625213362e72ff04144 | |
| parent | b5eb22732adc53767d9cb7390bb38475276ea880 (diff) | |
| download | gohugo-theme-ed-7ca5f7f20a14d4a2ad0e386d018bccacfa9000dc.tar.gz | |
Remove not needed stuf from search index
| -rw-r--r-- | layouts/index.json | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/layouts/index.json b/layouts/index.json index 2b8aa25..de685ff 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -19,19 +19,29 @@ {{/* Exclude virtual pages which aren't backed by a file */}} {{ if .File }} + + {{- $publishDate := $page.PublishDate -}} + {{- if $publishDate.IsZero -}} + {{ $publishDate = now -}} + {{- end -}} + + {{- $modifiedDate := $page.Lastmod -}} + {{- if $modifiedDate.IsZero -}} + {{ $modifiedDate = $publishDate -}} + {{- end -}} + {{- $pageData := (dict "objectID" $page.File.UniqueID - "publishDate" $page.PublishDate - "date" $page.Date.UTC.Unix - "lastmod" $page.Lastmod.UTC.Unix - "lang" ($page.Params.lang | default $page.Lang) "title" $page.Title "href" $page.Permalink + "lang" ($page.Params.lang | default $page.Lang) + "tags" ($page.Params.tags | default slice) "kind" $page.Kind "type" $page.Type "section" $page.Section - "content" $page.Plain - "tags" ($page.Params.tags | default slice) + "content" (trim $page.Plain "\n ") + "publishDate" $publishDate + "lastmod" $modifiedDate ) -}} {{- $.Scratch.Add "pagesIndex" $pageData -}} |
