README.md in middleman-blog-drafts-0.1.0 vs README.md in middleman-blog-drafts-0.2.0

- old
+ new

@@ -33,21 +33,37 @@ ``` ## Listing drafts on a page ```erb -<% if settings[:environment] == :development %> +<% if drafts.any? %> <ul> <% drafts.each do |draft| %> <li><%= link_to draft.title, draft.path %></li> <% end %> </ul> <% end %> ``` +As drafts won't be be available in the generated page by default, checking whether there are any is enough to decide whether to render the listing or not. + +## Configuration options + +`build`: when `true`, the drafts will be available unconditionally. If not given, the drafts will be available in middlemans development mode and unavailable in `middleman build`. + +This allows you to control the behaviour, for example if you have a preview instance of your blog. One way to do so would be to set it based on an environment variable: + +```ruby +activate :drafts do |drafts| + drafts.build = true if ENV["SHOW_DRAFTS"] +end +``` + +This activates drafts in any environment where `SHOW_DRAFTS` is given and uses the default otherwise. + ## Learn More -See the [blog extension guide](http://middlemanapp.com/blogging/) for detailed +See the [blog extension guide](http://middlemanapp.com/basics/blogging/) for detailed information on configuring and using the blog extension. ## Credits Most of the code was based on the [middleman-blog](https://github.com/middleman/middleman-blog)