From ecf5a4de621e25d93d00978923fe02d16ad544c8 Mon Sep 17 00:00:00 2001 From: John Muccigrosso Date: Fri, 29 Dec 2023 15:29:59 +0100 Subject: [PATCH 1/6] Add icon for Atom feed If there's a blog_icon defined in the _config.yml file, then this will insert it as an icon into the Atom feed. (Many readers don't support this, but some do.) --- lib/jekyll-feed/feed.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/jekyll-feed/feed.xml b/lib/jekyll-feed/feed.xml index 9068836f..92c346fe 100644 --- a/lib/jekyll-feed/feed.xml +++ b/lib/jekyll-feed/feed.xml @@ -27,6 +27,14 @@ {{ site.description | xml_escape }} {% endif %} + {% if site.blog_icon %} + {% assign blog_icon = site.blog_icon %} + {% unless blog_icon contains "://" %} + {% assign blog_icon = blog_icon | absolute_url %} + {% endunless %} + {{ blog_icon | xml_escape }} + {% endif %} + {% if site.author %} {{ site.author.name | default: site.author | xml_escape }} From 8b30b70782219ecc55f1a0fd58c70c6e02d583e0 Mon Sep 17 00:00:00 2001 From: John Muccigrosso Date: Sat, 30 Dec 2023 13:21:28 +0100 Subject: [PATCH 2/6] Add blog logo --- lib/jekyll-feed/feed.xml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/jekyll-feed/feed.xml b/lib/jekyll-feed/feed.xml index 92c346fe..a520e3b2 100644 --- a/lib/jekyll-feed/feed.xml +++ b/lib/jekyll-feed/feed.xml @@ -27,14 +27,22 @@ {{ site.description | xml_escape }} {% endif %} - {% if site.blog_icon %} - {% assign blog_icon = site.blog_icon %} + {% if site.blog.icon %} + {% assign blog_icon = site.blog.icon %} {% unless blog_icon contains "://" %} {% assign blog_icon = blog_icon | absolute_url %} {% endunless %} {{ blog_icon | xml_escape }} {% endif %} + {% if site.blog.logo %} + {% assign blog_logo = site.blog.logo %} + {% unless blog_logo contains "://" %} + {% assign blog_logo = blog_logo | absolute_url %} + {% endunless %} + {{ blog_logo | xml_escape }} + {% endif %} + {% if site.author %} {{ site.author.name | default: site.author | xml_escape }} From d019b9849dfbea4660a1d3b614c65595d332d435 Mon Sep 17 00:00:00 2001 From: John Muccigrosso Date: Sat, 30 Dec 2023 13:41:31 +0100 Subject: [PATCH 3/6] Include icon and log with example --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index a0f9d1f2..99d05170 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,15 @@ The plugin will automatically use any of the following configuration variables, * `description` - A longer description of what your site is about, e.g., "Where I blog about Jekyll and other awesome things" * `url` - The URL to your site, e.g., `https://example.com`. If none is provided, the plugin will try to use `site.github.url`. * `author` - Global author information (see below) +* `blog.icon` - Icon with 1:1 proportions for readers to use for the blog (not supported by all readers; often overridden by a favicon or site icon) +* `blog.logo` - Logo with 2:1 proportions for readers to use for the blog (not supported by all readers). + For example, both of the preceding can be expressed: + ```yml + blog: + icon: /images/icon.png + logo: /images/logo.png + ``` + ### Already have a feed path? From 30cdebca6cd48928d3139e80cb83afdc18fa236b Mon Sep 17 00:00:00 2001 From: John Muccigrosso Date: Sat, 6 Jan 2024 13:28:30 +0100 Subject: [PATCH 4/6] Switch to feed key --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 99d05170..e4f83f6d 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,11 @@ The plugin will automatically use any of the following configuration variables, * `description` - A longer description of what your site is about, e.g., "Where I blog about Jekyll and other awesome things" * `url` - The URL to your site, e.g., `https://example.com`. If none is provided, the plugin will try to use `site.github.url`. * `author` - Global author information (see below) -* `blog.icon` - Icon with 1:1 proportions for readers to use for the blog (not supported by all readers; often overridden by a favicon or site icon) -* `blog.logo` - Logo with 2:1 proportions for readers to use for the blog (not supported by all readers). +* `feed.icon` - Icon with 1:1 proportions for readers to use for the blog feed (not supported by all readers; often overridden by a favicon or site icon) +* `feed.logo` - Logo with 2:1 proportions for readers to use for the blog feed (not supported by all readers). For example, both of the preceding can be expressed: ```yml - blog: + feed: icon: /images/icon.png logo: /images/logo.png ``` From c0f31f37e9ea79ce8389dc6f5f7eb1ef177e9569 Mon Sep 17 00:00:00 2001 From: John Muccigrosso Date: Sat, 6 Jan 2024 13:30:49 +0100 Subject: [PATCH 5/6] Switch to feed key from blog: site.feed --- lib/jekyll-feed/feed.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/jekyll-feed/feed.xml b/lib/jekyll-feed/feed.xml index a520e3b2..dfc0bfff 100644 --- a/lib/jekyll-feed/feed.xml +++ b/lib/jekyll-feed/feed.xml @@ -27,20 +27,20 @@ {{ site.description | xml_escape }} {% endif %} - {% if site.blog.icon %} - {% assign blog_icon = site.blog.icon %} - {% unless blog_icon contains "://" %} - {% assign blog_icon = blog_icon | absolute_url %} + {% if site.feed.icon %} + {% assign feed_icon = site.feed.icon %} + {% unless feed_icon contains "://" %} + {% assign feed_icon = feed_icon | absolute_url %} {% endunless %} - {{ blog_icon | xml_escape }} + {{ feed_icon | xml_escape }} {% endif %} - {% if site.blog.logo %} - {% assign blog_logo = site.blog.logo %} - {% unless blog_logo contains "://" %} - {% assign blog_logo = blog_logo | absolute_url %} + {% if site.feed.logo %} + {% assign feed_logo = site.feed.logo %} + {% unless feed_logo contains "://" %} + {% assign feed_logo = feed_logo | absolute_url %} {% endunless %} - {{ blog_logo | xml_escape }} + {{ feed_logo | xml_escape }} {% endif %} {% if site.author %} From 44bd552afe04943965755252497181a03122e3a6 Mon Sep 17 00:00:00 2001 From: Christoph Scholz Date: Tue, 28 May 2024 14:16:58 +0200 Subject: [PATCH 6/6] Add test for blog icon and logo --- spec/jekyll-feed_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/jekyll-feed_spec.rb b/spec/jekyll-feed_spec.rb index 41514d1f..83d8e6e7 100644 --- a/spec/jekyll-feed_spec.rb +++ b/spec/jekyll-feed_spec.rb @@ -125,6 +125,8 @@ expect(feed.encoding).to eql("UTF-8") expect(feed.lang).to be_nil expect(feed.valid?).to eql(true) + expect(feed.icon).to be_nil + expect(feed.logo).to be_nil end it "outputs the link" do @@ -238,6 +240,24 @@ def to_s expect(feed.title.content).to eql(site_title.encode(xml: :text)) end end + + context "with site.icon set" do + let(:site_icon) { "myicon.png" } + let(:overrides) { { "feed" => { "icon" => site_icon } } } + + it "uses site.icon for the icon" do + expect(feed.icon.content).to eql("http://example.org/" + site_icon) + end + end + + context "with site.logo set" do + let(:site_logo) { "mylogo.png" } + let(:overrides) { { "feed" => { "logo" => site_logo } } } + + it "uses site.logo for the logo" do + expect(feed.logo.content).to eql("http://example.org/" + site_logo) + end + end end context "smartify" do