feat: add optional page description to search (#550)
Add optional page description to the search result list. The feature can be enabled by `geekdocSearchShowDescription=true` and is disabled by default. The max length of the description is set to `55` and will be truncated automatically if the limit is exceeded.
This commit is contained in:
parent
d82d05fffc
commit
fb905bd6c1
12 changed files with 87 additions and 91 deletions
|
@ -3,5 +3,6 @@
|
|||
{
|
||||
"dataFile": {{ $searchData.RelPermalink | jsonify }},
|
||||
"indexConfig": {{ .Site.Params.GeekdocSearchConfig | jsonify }},
|
||||
"showParent": {{ if .Site.Params.GeekdocSearchShowParent }}true{{ else }}false{{ end }}
|
||||
"showParent": {{ if .Site.Params.GeekdocSearchShowParent }}true{{ else }}false{{ end }},
|
||||
"showDescription": {{ if .Site.Params.GeekdocSearchshowDescription }}true{{ else }}false{{ end }}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
"href": "{{ $page.RelPermalink }}",
|
||||
"title": {{ (partial "utils/title" $page) | jsonify }},
|
||||
"parent": {{ with $page.Parent }}{{ (partial "utils/title" .) | jsonify }}{{ else }}""{{ end }},
|
||||
"content": {{ $page.Plain | jsonify }}
|
||||
"content": {{ $page.Plain | jsonify }},
|
||||
"description": {{ $page.Summary | plainify | jsonify }}
|
||||
}
|
||||
{{ end }}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue