Skip to content

Commit d8bf022

Browse files
committed
Fix search excerpts that run together
1 parent c56818c commit d8bf022

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515

1616
### Fixed
1717
- Fix Firefox [flexbox bug](https://bugzilla.mozilla.org/show_bug.cgi?id=939897) when printing pages.
18+
- Fix search excerpts that run together because of implied spaces.
1819

1920
## [1.3.1] - 2018-02-16
2021

assets/javascripts/search-data.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,25 @@ var store = [
1414
"title": {{ doc.title | jsonify }},
1515
"excerpt":
1616
{%- if site.search_full_content == true -%}
17-
{{ doc.content | strip_html | strip_newlines | jsonify }},
17+
{{ doc.content |
18+
replace:"</p>", " " |
19+
replace:"</h1>", " " |
20+
replace:"</h2>", " " |
21+
replace:"</h3>", " " |
22+
replace:"</h4>", " " |
23+
replace:"</h5>", " " |
24+
replace:"</h6>", " "|
25+
strip_html | strip_newlines | jsonify }},
1826
{%- else -%}
19-
{{ doc.content | strip_html | strip_newlines | truncatewords: 50 | jsonify }},
27+
{{ doc.content |
28+
replace:"</p>", " " |
29+
replace:"</h1>", " " |
30+
replace:"</h2>", " " |
31+
replace:"</h3>", " " |
32+
replace:"</h4>", " " |
33+
replace:"</h5>", " " |
34+
replace:"</h6>", " "|
35+
strip_html | strip_newlines | truncatewords: 50 | jsonify }},
2036
{%- endif -%}
2137
"categories": {{ doc.categories | jsonify }},
2238
"tags": {{ doc.tags | jsonify }},

0 commit comments

Comments
 (0)