Skip to content

Commit 9134151

Browse files
Add support custom title for collections
1 parent 6d4913f commit 9134151

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/jekyll-feed/feed.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
{% assign title = site.title | default: site.name %}
1313
{% if page.collection != "posts" %}
14-
{% assign collection = page.collection | capitalize %}
14+
{% assign collection = page.title | default: page.collection | capitalize %}
1515
{% assign title = title | append: " | " | append: collection %}
1616
{% endif %}
1717
{% if page.category %}

lib/jekyll-feed/generator.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def generate(site)
1414
path = feed_path(:collection => name, :category => category)
1515
next if file_exists?(path)
1616

17-
@site.pages << make_page(path, :collection => name, :category => category)
17+
@site.pages << make_page(path, :title => meta["title"], :collection => name, :category => category)
1818
end
1919
end
2020
generate_feed_by_tag if config["tags"] && !@site.tags.empty?
@@ -112,13 +112,14 @@ def file_exists?(file_path)
112112

113113
# Generates contents for a file
114114

115-
def make_page(file_path, collection: "posts", category: nil, tags: nil)
115+
def make_page(file_path, title: nil, collection: "posts", category: nil, tags: nil)
116116
PageWithoutAFile.new(@site, __dir__, "", file_path).tap do |file|
117117
file.content = feed_template
118118
file.data.merge!(
119119
"layout" => nil,
120120
"sitemap" => false,
121121
"xsl" => file_exists?("feed.xslt.xml"),
122+
"title" => title,
122123
"collection" => collection,
123124
"category" => category,
124125
"tags" => tags

0 commit comments

Comments
 (0)