Skip to content

Commit

Permalink
feat: custom excerpt image support
Browse files Browse the repository at this point in the history
Add new front meta named `excerpt_image` to custom excerpt image,
which priority is higher than banner image.
  • Loading branch information
jeffreytse committed Sep 22, 2023
1 parent c5f320f commit b576da9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions _includes/views/pagination-item.html
Original file line number Diff line number Diff line change
@@ -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' -%}
Expand All @@ -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' -%}
Expand All @@ -47,7 +48,7 @@ <h2 class="post-title">
</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">
Expand Down

0 comments on commit b576da9

Please sign in to comment.