diff --git a/assets/js/search.js b/assets/js/search.js index b89362e..cf4d850 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -5,7 +5,10 @@ function displayResults (results, store) { for (const n in results) { const item = store[results[n].ref]; resultList += '
' + item.content.substring(0, 150) + '...
' + if (item.description) + resultList += '' + item.description + '
' + else + resultList += '' + item.content.substring(0, 150) + '...
' } searchResults.innerHTML = resultList; } else { diff --git a/layouts/partials/search-form.html b/layouts/partials/search-form.html index 847e55b..d0c1455 100644 --- a/layouts/partials/search-form.html +++ b/layouts/partials/search-form.html @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/layouts/partials/search-index.html b/layouts/partials/search-index.html index 5415627..4276532 100644 --- a/layouts/partials/search-index.html +++ b/layouts/partials/search-index.html @@ -5,6 +5,7 @@ "title": "{{ .Title }}", "tags": [{{ range .Params.Tags }}"{{ . }}",{{ end }}], "content": {{ .Content | plainify }}, + "description": {{ .Description | plainify }}, "url": "{{ .Permalink }}" }, {{ end }} diff --git a/layouts/search/list.html b/layouts/search/list.html index 82bb25f..3edd248 100644 --- a/layouts/search/list.html +++ b/layouts/search/list.html @@ -1,6 +1,6 @@ {{ define "main" }} {{ partial "search-form.html" . }} - +