From 994bd34980959a6a8b5dab6c52e0b8336fdf494c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 17 Mar 2024 05:17:10 +0800 Subject: [PATCH] refactor: improve pr-1602 --- _includes/post-description.html | 3 ++- _includes/related-posts.html | 4 +--- _layouts/home.html | 5 ++-- _layouts/post.html | 3 +++ _posts/2019-08-08-text-and-typography.md | 4 +--- _posts/2019-08-08-write-a-new-post.md | 10 ++++---- _posts/2019-08-09-getting-started.md | 4 +++- _posts/2019-08-11-customize-the-favicon.md | 1 - _sass/layout/post.scss | 27 ++++++++++++++-------- assets/feed.xml | 2 +- 10 files changed, 35 insertions(+), 28 deletions(-) diff --git a/_includes/post-description.html b/_includes/post-description.html index a96e0c1a8af..73fced87c39 100644 --- a/_includes/post-description.html +++ b/_includes/post-description.html @@ -3,8 +3,9 @@ {% endcomment %} {% assign max_length = include.max_length | default: 200 %} + {% if post.description %} - {{ post.description | strip | truncate: max_length | escape }} + {{ post.description | strip | truncate: max_length }} {% else %} {% include no-linenos.html content=post.content %} {{ content | markdownify | strip_html | truncate: max_length | escape }} diff --git a/_includes/related-posts.html b/_includes/related-posts.html index 5dcb44abbf4..ae39da41f17 100644 --- a/_includes/related-posts.html +++ b/_includes/related-posts.html @@ -81,9 +81,7 @@

{{ post.title }}

-

- {% include post-description.html max_length=200 %} -

+

{% include post-description.html %}

diff --git a/_layouts/home.html b/_layouts/home.html index 1f572939a06..a9f5bd366a7 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -2,6 +2,7 @@ layout: default refactor: true --- + {% include lang.html %} {% assign pinned = site.posts | where: 'pin', 'true' %} @@ -71,9 +72,7 @@

{{ post.title }}

-

- {% include post-description.html max_length=300 %} -

+

{% include post-description.html %}

diff --git a/_layouts/post.html b/_layouts/post.html index f666d71642c..3f859f8dd48 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -14,6 +14,9 @@

{{ page.title }}

+ {% if page.description %} +

{{ page.description }}

+ {% endif %}