diff --git a/features/collections.feature b/features/collections.feature
index 33a01ade..03f10dc1 100644
--- a/features/collections.feature
+++ b/features/collections.feature
@@ -263,6 +263,104 @@ Feature: Collections
And the "_site/puppies/snowy.html" file should not exist
And the "_site/puppies/hardy.html" file should not exist
+ Scenario: Access rendered collection with future date and unpublished flag via Liquid
+ Given I have a _puppies directory
+ And I have the following documents under the puppies collection:
+ | title | date | content | published |
+ | Rover | 2007-12-31 | content for Rover. | true |
+ | Figor | 2007-12-31 | content for Figor. | false |
+ | Snowy | 2199-12-31 | content for Snowy. | true |
+ | Hardy | 2199-12-31 | content for Hardy. | false |
+ And I have a "_config.yml" file with content:
+ """
+ collections:
+ puppies:
+ output: true
+ """
+ And I have a "index.md" page that contains "{% for puppy in site.puppies %}
{{ puppy.title }}
{% endfor %}"
+ When I run jekyll build
+ Then I should get a zero exit status
+ And the _site directory should exist
+ And I should see "Rover
" in "_site/index.html"
+ But I should see "Snowy
" in "_site/index.html"
+ And I should not see "Figor
" in "_site/index.html"
+ And I should not see "Hardy
" in "_site/index.html"
+ And the "_site/puppies/rover.html" file should exist
+ And the "_site/puppies/snowy.html" file should not exist
+ And the "_site/puppies/figor.html" file should not exist
+ And the "_site/puppies/hardy.html" file should not exist
+ When I run jekyll build --unpublished
+ Then I should get a zero exit status
+ And the _site directory should exist
+ And I should see "Rover
" in "_site/index.html"
+ And I should see "Snowy
" in "_site/index.html"
+ And I should see "Figor
" in "_site/index.html"
+ But I should see "Hardy
" in "_site/index.html"
+ And the "_site/puppies/rover.html" file should exist
+ And the "_site/puppies/snowy.html" file should not exist
+ And the "_site/puppies/figor.html" file should exist
+ And the "_site/puppies/hardy.html" file should not exist
+ When I run jekyll build --unpublished --future
+ Then I should get a zero exit status
+ And the _site directory should exist
+ And I should see "Rover
" in "_site/index.html"
+ And I should see "Snowy
" in "_site/index.html"
+ And I should see "Figor
" in "_site/index.html"
+ But I should see "Hardy
" in "_site/index.html"
+ And the "_site/puppies/rover.html" file should exist
+ And the "_site/puppies/snowy.html" file should exist
+ And the "_site/puppies/figor.html" file should exist
+ And the "_site/puppies/hardy.html" file should exist
+
+ Scenario: Access unrendered collection with future date and unpublished flag via Liquid
+ Given I have a _puppies directory
+ And I have the following documents under the puppies collection:
+ | title | date | content | published |
+ | Rover | 2007-12-31 | content for Rover. | true |
+ | Figor | 2007-12-31 | content for Figor. | false |
+ | Snowy | 2199-12-31 | content for Snowy. | true |
+ | Hardy | 2199-12-31 | content for Hardy. | false |
+ And I have a "_config.yml" file with content:
+ """
+ collections:
+ puppies:
+ output: false
+ """
+ And I have a "index.md" page that contains "{% for puppy in site.puppies %}{{ puppy.title }}
{% endfor %}"
+ When I run jekyll build
+ Then I should get a zero exit status
+ And the _site directory should exist
+ And I should see "Rover
" in "_site/index.html"
+ But I should see "Snowy
" in "_site/index.html"
+ And I should not see "Figor
" in "_site/index.html"
+ And I should not see "Hardy
" in "_site/index.html"
+ And the "_site/puppies/rover.html" file should not exist
+ And the "_site/puppies/snowy.html" file should not exist
+ And the "_site/puppies/figor.html" file should not exist
+ And the "_site/puppies/hardy.html" file should not exist
+ When I run jekyll build --unpublished
+ Then I should get a zero exit status
+ And the _site directory should exist
+ And I should see "Rover
" in "_site/index.html"
+ And I should see "Snowy
" in "_site/index.html"
+ And I should see "Figor
" in "_site/index.html"
+ But I should see "Hardy
" in "_site/index.html"
+ And the "_site/puppies/rover.html" file should not exist
+ And the "_site/puppies/snowy.html" file should not exist
+ And the "_site/puppies/figor.html" file should not exist
+ And the "_site/puppies/hardy.html" file should not exist
+ When I run jekyll build --unpublished --future
+ Then I should get a zero exit status
+ And the _site directory should exist
+ And I should see "Rover
" in "_site/index.html"
+ And I should see "Snowy
" in "_site/index.html"
+ And I should see "Figor
" in "_site/index.html"
+ But I should see "Hardy
" in "_site/index.html"
+ And the "_site/puppies/rover.html" file should not exist
+ And the "_site/puppies/snowy.html" file should not exist
+ And the "_site/puppies/figor.html" file should not exist
+ And the "_site/puppies/hardy.html" file should not exist
+
Scenario: All the documents
Given I have an "index.html" page that contains "All documents: {% for doc in site.documents %}{{ doc.relative_path }} {% endfor %}"
And I have fixture collections
diff --git a/lib/jekyll/collection.rb b/lib/jekyll/collection.rb
index bdfa4b86..4a8b6f53 100644
--- a/lib/jekyll/collection.rb
+++ b/lib/jekyll/collection.rb
@@ -212,7 +212,9 @@ module Jekyll
def read_document(full_path)
doc = Document.new(full_path, :site => site, :collection => self)
doc.read
- docs << doc unless doc.data["published"] == false
+ if site.unpublished || doc.published?
+ docs << doc
+ end
end
private