diff --git a/_includes/post-description.html b/_includes/post-description.html
index c00e516533e..c9eb0c8196a 100644
--- a/_includes/post-description.html
+++ b/_includes/post-description.html
@@ -22,4 +22,4 @@
{%- endif -%}
{%- endcapture -%}
-{{- description | strip | truncate: max_length | escape -}}
+{{- description | strip | truncate: max_length | jsonify -}}
diff --git a/assets/js/data/search.json b/assets/js/data/search.json
index 32bcff9b0c5..16296beb0af 100644
--- a/assets/js/data/search.json
+++ b/assets/js/data/search.json
@@ -14,7 +14,7 @@ swcache: true
"categories": {{ post.categories | join: ', ' | jsonify }},
"tags": {{ post.tags | join: ', ' | jsonify }},
"date": "{{ post.date }}",
- "content": "{{ description }}"
+ "content": {{ description | strip_html | replace: "\\", "\\\\" | jsonify }}
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]