From 82f59f358333f0347f1852cf7a41082871a26d11 Mon Sep 17 00:00:00 2001 From: hikmetba-bit Date: Sat, 19 Sep 2026 17:21:32 +0300 Subject: [PATCH] Include tag name in per-tag feed titles, matching category feeds Category feeds already append the category name to the feed title (site title | Category). Per-tag feeds (generated when feed.tags is enabled) had no equivalent, so their was just the bare site title with no indication of which tag the feed is for. page.tags is set by the generator to a single tag name string for these pages (see generate_tag_feed/make_page), the same shape as page.category, so the added Liquid block mirrors the existing category block exactly. Fixes #406. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --- History.markdown | 4 ++++ lib/jekyll-feed/feed.xml | 4 ++++ spec/jekyll-feed_spec.rb | 2 ++ 3 files changed, 10 insertions(+) diff --git a/History.markdown b/History.markdown index 919afa8a..2259e08e 100644 --- a/History.markdown +++ b/History.markdown @@ -14,6 +14,10 @@ * Icon and logo support with simple tests (#412) +### Bug Fixes + + * Include the tag name in the title of per-tag feeds, matching category feeds (#406) + ## 0.17.0 / 2022-10-14 ### Documentation diff --git a/lib/jekyll-feed/feed.xml b/lib/jekyll-feed/feed.xml index dfc0bfff..4b5df418 100644 --- a/lib/jekyll-feed/feed.xml +++ b/lib/jekyll-feed/feed.xml @@ -18,6 +18,10 @@ {% assign category = page.category | capitalize %} {% assign title = title | append: " | " | append: category %} {% endif %} + {% if page.tags %} + {% assign tag = page.tags | capitalize %} + {% assign title = title | append: " | " | append: tag %} + {% endif %} {% if title %} <title type="html">{{ title | smartify | xml_escape }} diff --git a/spec/jekyll-feed_spec.rb b/spec/jekyll-feed_spec.rb index 6f5d58d0..33ee73ac 100644 --- a/spec/jekyll-feed_spec.rb +++ b/spec/jekyll-feed_spec.rb @@ -582,6 +582,8 @@ def to_s expect(Pathname.new(dest_dir("feed/by_tag/fail.xml"))).to exist expect(Pathname.new(dest_dir("feed/by_tag/success.xml"))).to exist + expect(tags_feed_test).to match 'My awesome site | Test' + expect(tags_feed_test).to match "/2013/12/12/dec-the-second.html" expect(tags_feed_test).to match "/2014/03/04/march-the-fourth.html" expect(tags_feed_test).to match "/2015/01/18/jekyll-last-modified-at.html"