module Middleman::Blog::Drafts::BlogDataExtensions

An extension to let {Middleman::Blog::BlogData} know about all draft articles in the site.

Public Instance Methods

draft(path) click to toggle source

A draft BlogArticle for the given path, or nil if one doesn't exist. @return [Middleman::Sitemap::Resource]

# File lib/middleman-blog-drafts/blog_data_extensions.rb, line 16
def draft(path)
  article = @app.sitemap.find_resource_by_path(path.to_s)
  if article && article.is_a?(BlogArticle)
    article
  else
    nil
  end
end
drafts(app=nil, options=nil) click to toggle source
# File lib/middleman-blog-drafts/blog_data_extensions.rb, line 10
def drafts(app=nil, options=nil)
  @_drafts ||= Middleman::Blog::Drafts::Data.new(self, app, options)
end