-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
make sure pages with published being false are not generated #1931
Conversation
I'm cool with making the behaviour consistent between the two models. @mattr-, what do you think? |
@mattr- what do you think of this pull request? |
@@ -21,6 +21,11 @@ def to_s | |||
self.content || '' | |||
end | |||
|
|||
# Helper methods to query boolean values specified in YAML frontmatter | |||
%w(published).each do |key| | |||
define_method("#{key}?") { !(self.data.has_key?(key) && self.data[key] == false) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have to implement this method this way? What prevents us from defining a normal method here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattr- I was thinking about later we may add similar methods to access boolean values in YAML front matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattr- I think you're right here, it's bad to do over-design with inelegant code. I've updated the commit, please have a look.
@mattr- When you get a minute, please review & merge if it looks good to you :) |
Thanks @mattr- 👍 |
In the documentation it says
published
can be used both in page and post. But it's only effective in post.This commit makes
published
front matter also effective for pages. It also refactors the current implementation ofpublished
feature.