Index meta.title as the real title of a page

This commit is contained in:
Peter Stuifzand 2020-07-19 17:20:38 +02:00
parent 0197cee9a2
commit b65e04a3cb

View File

@ -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)
}