diff --git a/lib/jekyll-feed/feed.xml b/lib/jekyll-feed/feed.xml index 9068836f..95ebc81c 100644 --- a/lib/jekyll-feed/feed.xml +++ b/lib/jekyll-feed/feed.xml @@ -50,6 +50,7 @@ {% unless site.show_drafts %} {% assign posts = posts | where_exp: "post", "post.draft != true" %} {% endunless %} + {% assign posts = posts | where_exp: "post", "post.hidden != true" %} {% assign posts = posts | sort: "date" | reverse %} {% assign posts_limit = site.feed.posts_limit | default: 10 %} {% for post in posts limit: posts_limit %} diff --git a/spec/fixtures/_posts/2024-01-31-hidden-sample.md b/spec/fixtures/_posts/2024-01-31-hidden-sample.md new file mode 100644 index 00000000..444d3e48 --- /dev/null +++ b/spec/fixtures/_posts/2024-01-31-hidden-sample.md @@ -0,0 +1,5 @@ +--- +hidden: true +--- + +# A hidden post \ No newline at end of file diff --git a/spec/jekyll-feed_spec.rb b/spec/jekyll-feed_spec.rb index 41514d1f..b9bb660c 100644 --- a/spec/jekyll-feed_spec.rb +++ b/spec/jekyll-feed_spec.rb @@ -50,6 +50,7 @@ expect(contents).to match "http://example.org/news/2013/12/12/dec-the-second.html" expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html" expect(contents).to_not match "http://example.org/2016/02/09/a-draft.html" + expect(contents).to_not match "http://example.org/2024/01/31/hidden-sample.html" end it "does not include assets or any static files that aren't .html" do @@ -411,6 +412,7 @@ def to_s expect(contents).to match "http://example.org/news/2013/12/12/dec-the-second.html" expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html" expect(contents).to_not match "http://example.org/2016/02/09/a-draft.html" + expect(contents).to_not match "http://example.org/2024/01/31/hidden-sample.html" end it "outputs the category feeds" do @@ -443,6 +445,7 @@ def to_s expect(contents).to match "http://example.org/news/2013/12/12/dec-the-second.html" expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html" expect(contents).to_not match "http://example.org/2016/02/09/a-draft.html" + expect(contents).to_not match "http://example.org/2024/01/31/hidden-sample.html" end it "outputs the category feed" do