From 2d389272f1f0efc01f2a958f17e1ed73578d5917 Mon Sep 17 00:00:00 2001 From: Jeffrey Tse Date: Sat, 26 Aug 2023 16:28:58 +0800 Subject: feat: rich excerpt with image support (#125) --- _includes/functions/get_article_excerpt.html | 2 +- _includes/views/pagination-item.html | 35 +++++++++++++++++++++++----- _includes/views/pagination.html | 6 ++++- 3 files changed, 35 insertions(+), 8 deletions(-) (limited to '_includes') diff --git a/_includes/functions/get_article_excerpt.html b/_includes/functions/get_article_excerpt.html index 2868b8d..b34a13f 100644 --- a/_includes/functions/get_article_excerpt.html +++ b/_includes/functions/get_article_excerpt.html @@ -12,7 +12,7 @@ {% assign excerpt_size = include.params.excerpt_size %} {% else %} {% assign excerpt_size = excerpt_size - | default: site.excerpt_size + | default: site.excerpt.text_size | default: 350 %} {% endif %} diff --git a/_includes/views/pagination-item.html b/_includes/views/pagination-item.html index fff6541..791fcda 100644 --- a/_includes/views/pagination-item.html +++ b/_includes/views/pagination-item.html @@ -4,11 +4,29 @@ {% assign lang = post.lang %} {%- include functions.html func='get_reading_time' -%} {% assign reading_time = return %} + {%- include functions.html func='get_article_excerpt' -%} {% assign excerpt = return %} {%- assign post_url = post.url | relative_url -%} -
  • +{%- assign name = 'excerpt.image_width' -%} +{%- include functions.html func='get_value' -%} +{%- assign image_width = return | default: '38.2%' -%} + +{%- assign name = 'excerpt.image_height' -%} +{%- include functions.html func='get_value' -%} +{%- assign image_height = return | default: '160px' -%} + +{%- assign name = 'excerpt.default_image' -%} +{%- include functions.html func='get_value' -%} +{%- assign default_image = return -%} + +{%- assign post_image = post.banner.image + | default: post.banner + | default: default_image + | default: '/assets/images/default-image.jpeg' -%} + +
  • {{ post.title | escape }} @@ -22,11 +40,16 @@ {%- endif -%} {{ reading_time }} - -

    - {{ excerpt }} Read More -

    -
    +
    + {%- if post_image -%} + +
    +
    + {%- endif -%} + +

    {{ excerpt }} Read More

    +
    +