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

Add --drafts flag #769

Merged
merged 11 commits into from Mar 4, 2013
Merged

Add --drafts flag #769

merged 11 commits into from Mar 4, 2013

Conversation

scribu
Copy link
Contributor

@scribu scribu commented Jan 20, 2013

I really liked the _drafts folder idea suggested by @mojombo a while ago:

It might be nice to have a --drafts switch that just picks up
and publishes stuff in a _drafts directory if it exists.

So, this pull request allows you to do this:

jekyll serve --watch --drafts

Related: #513

@scribu
Copy link
Contributor Author

scribu commented Jan 31, 2013

Fixed. Thanks for reviewing.

@mattr-
Copy link
Member

mattr- commented Jan 31, 2013

👍

@scribu
Copy link
Contributor Author

scribu commented Feb 2, 2013

After using this for a while, maybe it would make sense to exclude the date from the draft file names:

_drafts/some-post.md
_drafts/another-post.md

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.

@parkr
Copy link
Member

parkr commented Feb 3, 2013

@scribu I like that. You might need to change the filename, though. Post#process will freak out without the date.

@scribu
Copy link
Contributor Author

scribu commented Feb 9, 2013

The travis build reports lots of errors related to the unit tests.

I see failures when running rake features, but when I run rake test, I just get a link to the coverage report.

@scribu
Copy link
Contributor Author

scribu commented Feb 9, 2013

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,
Copy link
Member

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!

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Member

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)
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

@mojombo mojombo mentioned this pull request Mar 4, 2013
@mojombo mojombo merged commit 1a35128 into jekyll:master Mar 4, 2013
@mojombo
Copy link
Contributor

mojombo commented Mar 4, 2013

This is now merged into master. Thanks for the code, this is an awesome feature!

@scribu scribu deleted the drafts branch March 4, 2013 08:48
@nathanstaines
Copy link

Any idea when this feature will be available via the Ruby gem?

@parkr
Copy link
Member

parkr commented Mar 5, 2013

Soonish. No exact time :-)

@tillcarlos
Copy link

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!

@parkr
Copy link
Member

parkr commented Sep 4, 2013

@tielefeld There is presently no way to exclude drafts based on time. When using the --drafts flag, all drafts are added. :)

@tillcarlos
Copy link

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 :)

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants