perf: truncate post content for search results

This commit is contained in:
Cotes Chung 2022-10-22 03:33:09 +08:00
parent 1c330f403c
commit 647eea8dbd
No known key found for this signature in database
GPG key ID: 0D9E54843167A808

View file

@ -12,7 +12,7 @@ swcache: true
"tags": {{ post.tags | join: ', ' | jsonify }},
"date": "{{ post.date }}",
{% include no-linenos.html content=post.content %}
"snippet": {{ content | strip_html | strip_newlines | jsonify }}
"snippet": {{ content | strip_html | strip_newlines | truncate: 200 | jsonify }}
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]