Skip to content

Commit 2246052

Browse files
committed
Use collection title in collection feed links
1 parent 3e89e8d commit 2246052

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

lib/jekyll-feed/meta-tag.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,13 @@ def link(collection, category)
4444

4545
def attributes(collection, category)
4646
href = absolute_url(generator.feed_path(:collection => collection, :category => category))
47+
title = generator.feed_title(:collection => collection, :category => category)
4748
{
4849
:type => "application/atom+xml",
4950
:rel => "alternate",
5051
:href => href,
5152
:title => title,
52-
}.keep_if { |_, v| v }
53-
end
54-
55-
def title
56-
config["title"] || config["name"]
53+
}.delete_if { |_, v| v.strip.empty? }
5754
end
5855

5956
def valid_collection

spec/jekyll-feed_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@
349349

350350
it "renders the feed meta for the selected collection" do
351351
default_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed.xml" title="My awesome site" />'
352-
collection_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection.xml" title="My awesome site" />'
353-
category_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection/news.xml" title="My awesome site" />'
352+
collection_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection.xml" title="My awesome site | Collection" />'
353+
category_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection/news.xml" title="My awesome site | Collection | News" />'
354354
expect(default_feed).to eql(default_feed_link)
355355
expect(collection_feed).to eql(collection_feed_link)
356356
expect(category_feed).to eql(category_feed_link)
@@ -378,8 +378,8 @@
378378

379379
it "renders the feed meta for all collections and categories" do
380380
default_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed.xml" title="My awesome site" />'
381-
collection_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection.xml" title="My awesome site" />'
382-
category_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection/news.xml" title="My awesome site" />'
381+
collection_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection.xml" title="My awesome site | Collection" />'
382+
category_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection/news.xml" title="My awesome site | Collection | News" />'
383383
expect(full_feed_meta).to include(default_feed_link)
384384
expect(full_feed_meta).to include(collection_feed_link)
385385
expect(full_feed_meta).to include(category_feed_link)

0 commit comments

Comments
 (0)