Module: Middleman::BlogPage::Helpers

Defined in:
lib/middleman-blog_page/extension_3_0.rb

Overview

Helpers for use within templates and layouts.

Instance Method Summary collapse

Instance Method Details

#blog_page(options = nil) ⇒ BlogPageData

Get the BlogPageData for this site.

Returns:



76
77
78
# File 'lib/middleman-blog_page/extension_3_0.rb', line 76

def blog_page(options=nil)
  @_blog_page ||= BlogPageData.new(self, options)
end

#blog_pagesArray<Middleman::Sitemap::Resource>

Returns the list of articles to display on this page.

Returns:

  • (Array<Middleman::Sitemap::Resource>)


99
100
101
# File 'lib/middleman-blog_page/extension_3_0.rb', line 99

def blog_pages
  blog_page.pages
end

#current_blog_pageMiddleman::Sitemap::Resource

Get a Resource with mixed in BlogArticle methods representing the current article.

Returns:

  • (Middleman::Sitemap::Resource)


89
90
91
# File 'lib/middleman-blog_page/extension_3_0.rb', line 89

def current_blog_page
  blog_page.page(current_resource.path)
end

#current_blog_page?(page) ⇒ Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/middleman-blog_page/extension_3_0.rb', line 93

def current_blog_page?(page)
  current_blog_page == page
end

#is_blog_page?Boolean

Determine whether the currently rendering template is a blog article. This can be useful in layouts.

Returns:

  • (Boolean)


83
84
85
# File 'lib/middleman-blog_page/extension_3_0.rb', line 83

def is_blog_page?
  !current_blog_page.nil?
end