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

@ -7,6 +7,7 @@
### Bug Fixes ### Bug Fixes
* Replace `absolute_url` filter with `relative_url` where it makes sense (asset/nagivation related paths). [#1588](https://github.com/mmistakes/minimal-mistakes/issues/1588) * Replace `absolute_url` filter with `relative_url` where it makes sense (asset/nagivation related paths). [#1588](https://github.com/mmistakes/minimal-mistakes/issues/1588)
* Fix search excerpts that run together because of implied spaces.
## [4.10.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.10.1) ## [4.10.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.10.1)

View file

@ -18,9 +18,25 @@ var store = [
"title": {{ doc.title | jsonify }}, "title": {{ doc.title | jsonify }},
"excerpt": "excerpt":
{%- if site.search_full_content == true -%} {%- 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 -%} {%- 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 -%} {%- endif -%}
"categories": {{ doc.categories | jsonify }}, "categories": {{ doc.categories | jsonify }},
"tags": {{ doc.tags | jsonify }}, "tags": {{ doc.tags | jsonify }},

View file

@ -4,7 +4,7 @@ permalink: /docs/history/
excerpt: "Change log of enhancements and bug fixes made to the theme." excerpt: "Change log of enhancements and bug fixes made to the theme."
sidebar: sidebar:
nav: docs nav: docs
last_modified_at: 2018-03-20T11:35:28-04:00 last_modified_at: 2018-03-20T11:48:04-04:00
toc: true toc: true
--- ---
@ -17,6 +17,7 @@ toc: true
### Bug Fixes ### Bug Fixes
* Replace `absolute_url` filter with `relative_url` where it makes sense (asset/nagivation related paths). [#1588](https://github.com/mmistakes/minimal-mistakes/issues/1588) * Replace `absolute_url` filter with `relative_url` where it makes sense (asset/nagivation related paths). [#1588](https://github.com/mmistakes/minimal-mistakes/issues/1588)
* Fix search excerpts that run together because of implied spaces.
## [4.10.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.10.1) ## [4.10.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.10.1)