From e9b0a3f3f0df86d6f760beab5701016720590428 Mon Sep 17 00:00:00 2001 From: Lee Kai Ze Date: Tue, 4 Nov 2025 23:53:57 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20feat:=20added=20auto-generated?= =?UTF-8?q?=20summary=20to=20post=20listing=20and=20atom=20feeds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Post listing and Atom feeds will show post summary in separate paragraph alongside with post description. New defaults (breaking changes): - auto_generated_summary_length = 300 - auto_generated_post_listing_summary = true - auto_generated_atom_feed_summary = true --- config.toml | 7 +++++++ static/feed_style.xsl | 5 +++-- templates/atom.xml | 17 ++++++++++++----- templates/macros/list_posts.html | 9 ++++++--- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/config.toml b/config.toml index 9a6a90e7..e6fade0c 100644 --- a/config.toml +++ b/config.toml @@ -171,6 +171,13 @@ show_date = true # "both" - Show both the original date and the last updated date. post_listing_date = "date" +# Auto generate summary for post listing and Atom feeds. +# It will be generated in separated paragraph alongside with post description. +# Auto generated when no summary is set using the tag. +auto_generated_summary_length = 300 +auto_generated_post_listing_summary = true +auto_generated_atom_feed_summary = true + # Enable iine like buttons on all posts: https://iine.to/ # Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy iine = true diff --git a/static/feed_style.xsl b/static/feed_style.xsl index 1e413bbb..785c8177 100644 --- a/static/feed_style.xsl +++ b/static/feed_style.xsl @@ -1,6 +1,7 @@ + xmlns:atom="http://www.w3.org/2005/Atom" xmlns:tabi="https://github.com/welpo/tabi" + xmlns:xhtml="http://www.w3.org/1999/xhtml"> @@ -100,7 +101,7 @@
- +
diff --git a/templates/atom.xml b/templates/atom.xml index 3e5b55c4..f19c3bf9 100644 --- a/templates/atom.xml +++ b/templates/atom.xml @@ -100,11 +100,18 @@ {% if config.extra.full_content_in_feed %} {{ page.content }} {% endif -%} - {% if page.description -%} - {{ page.description }} - {% elif page.summary -%} - {{ page.summary | striptags | trim_end_matches(pat=".") | safe }}… - {% endif -%} + +
+ {% if page.description -%} +

{{ page.description | markdown(inline=true) | safe }}

+ {% endif %} + {% if page.summary -%} +

{{ page.summary | striptags | trim_end_matches(pat=".") | safe }}...

+ {% elif config.extra.auto_generated_atom_feed_summary %} +

{{ page.content | striptags | truncate(length=config.extra.auto_generated_summary_length) | safe }}

+ {% endif %} +
+
{%- endfor %} diff --git a/templates/macros/list_posts.html b/templates/macros/list_posts.html index f05eb3c2..3d06eaeb 100644 --- a/templates/macros/list_posts.html +++ b/templates/macros/list_posts.html @@ -164,9 +164,12 @@
{% if post.description %} -

{{ post.description | markdown(inline=true) | safe }}

- {% elif post.summary %} -

{{ post.summary | markdown(inline=true) | trim_end_matches(pat=".") | safe }}…

+

{{ post.description | markdown(inline=true) | safe }}

+ {% endif %} + {% if post.summary %} +

{{ post.summary | striptags | trim_end_matches(pat=".") | safe }}...

+ {% elif config.extra.auto_generated_post_listing_summary %} +

{{ post.content | striptags | truncate(length=config.extra.auto_generated_summary_length) | safe }}

{% endif %}
{{ macros_translate::translate(key="read_more", default="Read more", language_strings=language_strings) }}  From 85ec51cf97eb972965b8f4b78e4c7e50cfce7ee5 Mon Sep 17 00:00:00 2001 From: Lee Kai Ze Date: Thu, 13 Nov 2025 15:12:59 +0800 Subject: [PATCH 2/5] fix(summary): update default parameters Default to: auto_generate_post_summary = true auto_generated_summary_length = 200 Addresses https://github.com/welpo/tabi/pull/579 Closes https://github.com/welpo/tabi/issues/491 --- config.toml | 9 ++++----- templates/atom.xml | 3 ++- templates/macros/list_posts.html | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config.toml b/config.toml index e6fade0c..a15fef70 100644 --- a/config.toml +++ b/config.toml @@ -171,12 +171,11 @@ show_date = true # "both" - Show both the original date and the last updated date. post_listing_date = "date" -# Auto generate summary for post listing and Atom feeds. +# Auto generate summary for post listing and Atom feeds, +# when no summary is set using the tag. # It will be generated in separated paragraph alongside with post description. -# Auto generated when no summary is set using the tag. -auto_generated_summary_length = 300 -auto_generated_post_listing_summary = true -auto_generated_atom_feed_summary = true +auto_generate_post_summary = true +auto_generated_summary_length = 200 # Enable iine like buttons on all posts: https://iine.to/ # Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy diff --git a/templates/atom.xml b/templates/atom.xml index f19c3bf9..0a9e8c4e 100644 --- a/templates/atom.xml +++ b/templates/atom.xml @@ -101,13 +101,14 @@ {{ page.content }} {% endif -%} +
{% if page.description -%}

{{ page.description | markdown(inline=true) | safe }}

{% endif %} {% if page.summary -%}

{{ page.summary | striptags | trim_end_matches(pat=".") | safe }}...

- {% elif config.extra.auto_generated_atom_feed_summary %} + {% elif config.extra.auto_generate_post_summary %}

{{ page.content | striptags | truncate(length=config.extra.auto_generated_summary_length) | safe }}

{% endif %}
diff --git a/templates/macros/list_posts.html b/templates/macros/list_posts.html index 3d06eaeb..c96730e1 100644 --- a/templates/macros/list_posts.html +++ b/templates/macros/list_posts.html @@ -168,7 +168,7 @@ {% endif %} {% if post.summary %}

{{ post.summary | striptags | trim_end_matches(pat=".") | safe }}...

- {% elif config.extra.auto_generated_post_listing_summary %} + {% elif config.extra.auto_generate_post_summary %}

{{ post.content | striptags | truncate(length=config.extra.auto_generated_summary_length) | safe }}

{% endif %} From acb5c0f330d78833d35db9fce8dae55ac74f43ae Mon Sep 17 00:00:00 2001 From: Lee Kai Ze Date: Thu, 13 Nov 2025 15:20:17 +0800 Subject: [PATCH 3/5] fix(summary): add default configs under theme.toml --- theme.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/theme.toml b/theme.toml index c48f287c..176b2962 100644 --- a/theme.toml +++ b/theme.toml @@ -117,6 +117,12 @@ show_date = true # "both" - Show both the original date and the last updated date. post_listing_date = "date" +# Auto generate summary for post listing and Atom feeds, +# when no summary is set using the tag. +# It will be generated in separated paragraph alongside with post description. +auto_generate_post_summary = true +auto_generated_summary_length = 200 + # Enable iine like buttons on all posts: https://iine.to/ # Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy iine = false From 876c3f64a9d169a2c06dd78c05ff1a07961182b4 Mon Sep 17 00:00:00 2001 From: welpo Date: Sat, 31 Jan 2026 21:20:27 +0100 Subject: [PATCH 4/5] cooler ellipses --- templates/macros/list_posts.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/macros/list_posts.html b/templates/macros/list_posts.html index c96730e1..5eed1ab2 100644 --- a/templates/macros/list_posts.html +++ b/templates/macros/list_posts.html @@ -167,7 +167,7 @@

{{ post.description | markdown(inline=true) | safe }}

{% endif %} {% if post.summary %} -

{{ post.summary | striptags | trim_end_matches(pat=".") | safe }}...

+

{{ post.summary | striptags | trim_end_matches(pat=".") | safe }}…

{% elif config.extra.auto_generate_post_summary %}

{{ post.content | striptags | truncate(length=config.extra.auto_generated_summary_length) | safe }}

{% endif %} From 8c24c2bab5d0a306728ce3de1fc774344ab58947 Mon Sep 17 00:00:00 2001 From: welpo Date: Sat, 31 Jan 2026 21:20:38 +0100 Subject: [PATCH 5/5] avoid empty divs --- templates/atom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/atom.xml b/templates/atom.xml index 0a9e8c4e..46eb9b7e 100644 --- a/templates/atom.xml +++ b/templates/atom.xml @@ -100,19 +100,20 @@ {% if config.extra.full_content_in_feed %} {{ page.content }} {% endif -%} + {% if page.description or page.summary or config.extra.auto_generate_post_summary %} -
{% if page.description -%}

{{ page.description | markdown(inline=true) | safe }}

{% endif %} {% if page.summary -%} -

{{ page.summary | striptags | trim_end_matches(pat=".") | safe }}...

+

{{ page.summary | striptags | trim_end_matches(pat=".") | safe }}…

{% elif config.extra.auto_generate_post_summary %}

{{ page.content | striptags | truncate(length=config.extra.auto_generated_summary_length) | safe }}

{% endif %}
+ {% endif %} {%- endfor %}