File tree Expand file tree Collapse file tree 6 files changed +44
-34
lines changed Expand file tree Collapse file tree 6 files changed +44
-34
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ {%- comment -%}
2+ Get the post's description or body content.
3+
4+ Arguments:
5+ full_text: If true, return the full content. Default is false.
6+ max_length: The maximum length of the returned content. Default is 200.
7+ {%- endcomment -%}
8+
9+ {%- if post.description and include.full_text != true -%}
10+ {{- post.description -}}
11+ {%- else -%}
12+ {%- comment -%} Remove the line numbers from the code snippet. {%- endcomment -%}
13+
14+ {%- assign content = post.content -%}
15+
16+ {%- if content contains '< td class ="rouge-gutter gl "> < pre class ="lineno "> ' -%}
17+ {%- assign content = content
18+ | replace: '< td class ="rouge-gutter gl "> < pre class ="lineno "> ',
19+ '<!-- <td class="rouge-gutter gl"><pre class="lineno">'
20+ -%}
21+ {%- assign content = content | replace: '</td><td class="rouge-code">', '</td> --> < td class ="rouge-code "> ' -%}
22+ {%- endif -%}
23+
24+ {%- assign content = content
25+ | markdownify
26+ | strip_html
27+ | newline_to_br
28+ | replace: '< br /> ', ' '
29+ | strip_newlines
30+ | strip
31+ -%}
32+
33+ {%- unless include.full_text -%}
34+ {%- assign max_length = include.max_length | default: 200 -%}
35+ {%- assign content = content | truncate: max_length -%}
36+ {%- endunless -%}
37+
38+ {{- content -}}
39+ {%- endif -%}
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ <h3 class="mb-4" id="related-label">
8282 {% include datetime.html date=post.date lang=include.lang %}
8383 < h4 class ="pt-0 my-2 "> {{ post.title }}</ h4 >
8484 < div class ="text-muted ">
85- < p > {% include post-description .html %}</ p >
85+ < p > {% include post-summary .html %}</ p >
8686 </ div >
8787 </ div >
8888 </ a >
Original file line number Diff line number Diff line change 7878 < h1 class ="card-title my-2 mt-md-0 "> {{ post.title }}</ h1 >
7979
8080 < div class ="card-text content mt-0 mb-3 ">
81- < p > {% include post-description .html %}</ p >
81+ < p > {% include post-summary .html %}</ p >
8282 </ div >
8383
8484 < div class ="post-meta flex-grow-1 d-flex align-items-end ">
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ permalink: /feed.xml
4545 {% endfor %}
4646 {% endif %}
4747
48- <summary >{% include post-description .html max_length=400 %}</summary >
48+ <summary >{% include post-summary .html max_length=400 %}</summary >
4949
5050 </entry >
5151{% endfor %}
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ swcache: true
1111 "categories" : {{ post.categories | join: ', ' | jsonify }},
1212 "tags" : {{ post.tags | join: ', ' | jsonify }},
1313 "date" : {{ post.date | jsonify }},
14- "content" : {% include post-description.html json=true % }
14+ {% capture content -% }{% include post-summary.html full_text=true % }{%- endcapture -% }
15+ "content" : {{ content | jsonify }}
1516 }{% unless forloop.last % },{% endunless % }
1617 {% endfor % }
1718]
You can’t perform that action at this time.
0 commit comments