diff options
author | Jeffrey Tse <jeffreytse.mail@gmail.com> | 2023-09-22 21:28:42 +0800 |
---|---|---|
committer | Jeffrey Tse <jeffreytse.mail@gmail.com> | 2023-09-22 21:28:42 +0800 |
commit | b576da99a8b7d1cbf95506a63177f7174190bbc4 (patch) | |
tree | 328776a78845e4ebfc34e42e71f193f0c7740297 | |
parent | c5f320ff18d2d1ab9ac74283d0c209979bbd55fe (diff) |
feat: custom excerpt image support
Add new front meta named `excerpt_image` to custom excerpt image,
which priority is higher than banner image.
-rw-r--r-- | _includes/views/pagination-item.html | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/_includes/views/pagination-item.html b/_includes/views/pagination-item.html index 791fcda..0b31a3c 100644 --- a/_includes/views/pagination-item.html +++ b/_includes/views/pagination-item.html @@ -1,12 +1,12 @@ {%- assign date_format = site.yat.date_format | default: "%b %-d, %Y" -%} -{% assign article = post.content %} -{% assign lang = post.lang %} +{%- assign article = post.content -%} +{%- assign lang = post.lang -%} {%- include functions.html func='get_reading_time' -%} -{% assign reading_time = return %} +{%- assign reading_time = return -%} {%- include functions.html func='get_article_excerpt' -%} -{% assign excerpt = return %} +{%- assign article_excerpt = return -%} {%- assign post_url = post.url | relative_url -%} {%- assign name = 'excerpt.image_width' -%} @@ -21,7 +21,8 @@ {%- include functions.html func='get_value' -%} {%- assign default_image = return -%} -{%- assign post_image = post.banner.image +{%- assign post_image = post.excerpt_image + | default: post.banner.image | default: post.banner | default: default_image | default: '/assets/images/default-image.jpeg' -%} @@ -47,7 +48,7 @@ </a> {%- endif -%} <a class="post-text" href="{{ post_url }}"> - <p>{{ excerpt }} <span class="read_more">Read More</span></p> + <p>{{ article_excerpt }} <span class="read_more">Read More</span></p> </a> </div> <div class="post-tags"> |