From b65e04a3cbcc1e4e0403db3036fbd5fb8b2b76de Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sun, 19 Jul 2020 17:20:38 +0200 Subject: [PATCH] Index meta.title as the real title of a page --- search.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/search.go b/search.go index 0e21319..942688f 100644 --- a/search.go +++ b/search.go @@ -197,7 +197,12 @@ func createSearchObject(page Page) (searchObject, error) { for _, li := range listItems { meta := strings.SplitN(li.Text, "::", 2) if len(meta) == 2 { - so.Meta[strings.ToLower(strings.TrimSpace(meta[0]))] = strings.ToLower(strings.TrimSpace(meta[1])) + key := strings.ToLower(strings.TrimSpace(meta[0])) + value := strings.ToLower(strings.TrimSpace(meta[1])) + if (key == "title") { + so.Title = value + } + so.Meta[key] = value } so.Blocks = append(so.Blocks, li.Text) }