From baffa4ee3012a5b541c478eea1f317813ce91549 Mon Sep 17 00:00:00 2001 From: walcutt Date: Mon, 30 Jan 2023 15:49:35 -0500 Subject: [PATCH] Updated search result styling and preview --- _pages/search.md | 5 +++-- _sass/_style.scss | 6 +++++- search.json | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/_pages/search.md b/_pages/search.md index 2830d6f..7756ecf 100644 --- a/_pages/search.md +++ b/_pages/search.md @@ -6,7 +6,7 @@ permalink: /search - +
@@ -15,7 +15,8 @@ permalink: /search searchInput: document.getElementById('search-input'), resultsContainer: document.getElementById('results-container'), json:'{{ site.baseurl }}/search.json', - searchResultTemplate: '
  • {title}
  • ', + searchResultTemplate: '
    {title}
    {excerpt}
    ', + // searchResultTemplate: '
  • {title}
  • ', noResultsText: 'No results found', limit: 10 }); diff --git a/_sass/_style.scss b/_sass/_style.scss index b439cec..b7e8954 100644 --- a/_sass/_style.scss +++ b/_sass/_style.scss @@ -121,12 +121,16 @@ nav { } } -.backlink-box { +.backlink-box, .search-result-box { background: $color-box-background; padding: 1em; border-radius: $border-radius; } +.search-result-box { + margin-bottom: 1em; +} + code { background: #f5f5f5; padding: 0.1em 0.2em; diff --git a/search.json b/search.json index 9cec5b0..eaca25e 100644 --- a/search.json +++ b/search.json @@ -9,7 +9,8 @@ layout: none "tags" : "{{ post.tags | join: ', ' }}", "url" : "{{ site.baseurl }}{{ post.url }}", "date" : "{{ post.date }}", - "content" : "{{ post.content | strip_html | strip_newlines | smartify }}" + "content" : "{{ post.content | strip_html | strip_newlines | smartify }}", + "excerpt" : "{{ post.content | strip_html | strip_newlines | smartify | truncatewords: 10}}" } {% unless forloop.last %},{% endunless %} {% endfor %} ] \ No newline at end of file