Skip to content

Commit 81886b1

Browse files
committed
Merge branch 'hotfix/7.3.1' into production
2 parents 53770e4 + 7615d72 commit 81886b1

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

_includes/post-description.html

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,29 @@
22
Get post description or generate it from the post content.
33
{%- endcomment -%}
44

5-
{%- assign max_length = include.max_length | default: 200 -%}
6-
75
{%- capture description -%}
8-
{%- if post.description -%}
9-
{{- post.description -}}
10-
{%- else -%}
11-
{% comment %}
12-
Remove the line number of the code snippet.
13-
{% endcomment %}
14-
{% assign content = post.content %}
6+
{%- if post.description -%}
7+
{{- post.description -}}
8+
{%- else -%}
9+
{% comment %}
10+
Remove the line number of the code snippet.
11+
{% endcomment %}
12+
{%- assign content = post.content -%}
1513

16-
{% if content contains '<td class="rouge-gutter gl"><pre class="lineno">' %}
17-
{% assign content = content | replace: '<td class="rouge-gutter gl"><pre class="lineno">', '<!-- <td class="rouge-gutter gl"><pre class="lineno">'%}
18-
{% assign content = content | replace: '</td><td class="rouge-code">', '</td> --><td class="rouge-code">' %}
19-
{% endif %}
14+
{%- if content contains '<td class="rouge-gutter gl"><pre class="lineno">' -%}
15+
{%- assign content = content | replace: '<td class="rouge-gutter gl"><pre class="lineno">', '<!-- <td class="rouge-gutter gl"><pre class="lineno">' -%}
16+
{%- assign content = content | replace: '</td><td class="rouge-code">', '</td> --><td class="rouge-code">' -%}
17+
{%- endif -%}
2018

21-
{{- content | markdownify | strip_html | newline_to_br | replace: '<br />', ' ' | strip_newlines -}}
22-
{%- endif -%}
19+
{{- content | strip_html | newline_to_br | replace: '<br />', ' ' | strip_newlines -}}
20+
{%- endif -%}
2321
{%- endcapture -%}
2422

25-
{{- description | strip | truncate: max_length | escape -}}
23+
{%- if include.json -%}
24+
{%- assign description = description | jsonify -%}
25+
{%- else -%}
26+
{%- assign max_length = include.max_length | default: 200 -%}
27+
{%- assign description = description | strip | truncate: max_length -%}
28+
{%- endif -%}
29+
30+
{{- description -}}

assets/js/data/search.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@ swcache: true
55

66
[
77
{% for post in site.posts %}
8-
{%- capture description -%}
9-
{% include post-description.html %}
10-
{%- endcapture -%}
118
{
129
"title": {{ post.title | jsonify }},
1310
"url": {{ post.url | relative_url | jsonify }},
1411
"categories": {{ post.categories | join: ', ' | jsonify }},
1512
"tags": {{ post.tags | join: ', ' | jsonify }},
16-
"date": "{{ post.date }}",
17-
"content": "{{ description }}"
13+
"date": {{ post.date | jsonify }},
14+
"content": {% include post-description.html json=true %}
1815
}{% unless forloop.last %},{% endunless %}
1916
{% endfor %}
2017
]

0 commit comments

Comments
 (0)