Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out hidden posts #404

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/jekyll-feed/feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
5 changes: 5 additions & 0 deletions spec/fixtures/_posts/2024-01-31-hidden-sample.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
hidden: true
---

# A hidden post
3 changes: 3 additions & 0 deletions spec/jekyll-feed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down