Skip to content

Commit ce483fb

Browse files
Add support custom title for collections
1 parent 7d9c3a4 commit ce483fb

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
@@ -18,7 +18,7 @@ def generate(site)
1818
path = feed_path(:collection => name, :category => category)
1919
next if file_exists?(path)
2020

21-
@site.pages << make_page(path, :collection => name, :category => category)
21+
@site.pages << make_page(path, :title => meta["title"], :collection => name, :category => category)
2222
end
2323
end
2424
generate_feed_by_tag if config["tags"] && !@site.tags.empty?
@@ -117,13 +117,14 @@ def file_exists?(file_path)
117117

118118
# Generates contents for a file
119119

120-
def make_page(file_path, collection: "posts", category: nil, tags: nil)
120+
def make_page(file_path, title: nil, collection: "posts", category: nil, tags: nil)
121121
PageWithoutAFile.new(@site, __dir__, "", file_path).tap do |file|
122122
file.content = feed_template
123123
file.data.merge!(
124124
"layout" => nil,
125125
"sitemap" => false,
126126
"xsl" => file_exists?("feed.xslt.xml"),
127+
"title" => title,
127128
"collection" => collection,
128129
"category" => category,
129130
"tags" => tags

0 commit comments

Comments
 (0)