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
Add --drafts flag #769
Add --drafts flag #769
Conversation
Fixed. Thanks for reviewing. |
👍 |
After using this for a while, maybe it would make sense to exclude the date from the draft file names:
since most of the time you're not sure when the draft will be ready to get published. Of course, that would mean that Jekyll would need to generate some arbitrary date for each draft. Using the file's lastmodified attribute would work pretty well, I think. Authors should still be able to set the date in the front matter, if they wish. |
@scribu I like that. You might need to change the filename, though. |
The travis build reports lots of errors related to the unit tests. I see failures when running |
Yay, all tests pass again. |
@@ -5,7 +5,7 @@ module Jekyll | |||
class Site | |||
attr_accessor :config, :layouts, :posts, :pages, :static_files, | |||
:categories, :exclude, :include, :source, :dest, :lsi, :pygments, | |||
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts, | |||
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts, :show_drafts, |
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.
Please put this option on the next line, with :keep_files
. We have a column width limit!
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.
Ok, and what is that limit? 'cause that line already had 90 chars without :show_drafts.
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.
In general, I can't find a link to a page describing the coding standards anywhere.
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.
As this is a @mojombo project (primarily), we tend to use the GitHub style guide for Ruby.
@@ -66,6 +65,11 @@ def initialize(site, source, dir, name) | |||
end | |||
end | |||
|
|||
# Get the full path to the directory containing the post files | |||
def get_base(source, dir) |
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.
Perhaps containing_dir
, dirname
or something similar here. Ruby idioms tend to disagree with get_
- and set_
-prefixed methods.
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.
Good idea.
This is now merged into master. Thanks for the code, this is an awesome feature! |
Any idea when this feature will be available via the Ruby gem? |
Soonish. No exact time :-) |
Yeah, what a great feature! However, I would like to know if I can make a if condition checking for the draft stage of a post. Right now I cannot find another solution than matching the date against the Time.now (which is not that elegant). I have searched the documentation and a bit in in the code. Can someone help me where to find it? Thanks so much! |
@tielefeld There is presently no way to exclude drafts based on time. When using the |
It's alright. I used a tag for it "draft" which I remove when uploading. However, I switched to wordpress for my new project. pleasedontkillme! tielefeld.com is still jekyll :) |
I really liked the _drafts folder idea suggested by @mojombo a while ago:
So, this pull request allows you to do this:
Related: #513