Fix search excerpts that run together

This commit is contained in:
Michael Rose
2018-03-20 11:48:30 -04:00
parent c8226a32a6
commit 5e60d2d3c5
3 changed files with 21 additions and 3 deletions

View File

@@ -18,9 +18,25 @@ var store = [
"title": {{ doc.title | jsonify }},
"excerpt":
{%- if site.search_full_content == true -%}
{{ doc.content | strip_html | strip_newlines | jsonify }},
{{ doc.content |
replace:"</p>", " " |
replace:"</h1>", " " |
replace:"</h2>", " " |
replace:"</h3>", " " |
replace:"</h4>", " " |
replace:"</h5>", " " |
replace:"</h6>", " "|
strip_html | strip_newlines | jsonify }},
{%- else -%}
{{ doc.content | strip_html | strip_newlines | truncatewords: 50 | jsonify }},
{{ doc.content |
replace:"</p>", " " |
replace:"</h1>", " " |
replace:"</h2>", " " |
replace:"</h3>", " " |
replace:"</h4>", " " |
replace:"</h5>", " " |
replace:"</h6>", " "|
strip_html | strip_newlines | truncatewords: 50 | jsonify }},
{%- endif -%}
"categories": {{ doc.categories | jsonify }},
"tags": {{ doc.tags | jsonify }},