Module: Middleman::CoreExtensions::FrontMatter::ResourceInstanceMethods

Defined in:
lib/middleman-core/core_extensions/front_matter.rb

Instance Method Summary collapse

Instance Method Details

#content_typeObject

Override Resource#content_type to take into account frontmatter



76
77
78
79
80
81
# File 'lib/middleman-core/core_extensions/front_matter.rb', line 76

def content_type
  # Allow setting content type in frontmatter too
  raw_data.fetch :content_type do
    super
  end
end

#dataHash

This page’s frontmatter

Returns:

  • (Hash)


71
72
73
# File 'lib/middleman-core/core_extensions/front_matter.rb', line 71

def data
  @enhanced_data ||= ::Middleman::Util.recursively_enhance(raw_data).freeze
end

#ignored?Boolean

Returns:

  • (Boolean)


53
54
55
56
57
58
59
# File 'lib/middleman-core/core_extensions/front_matter.rb', line 53

def ignored?
  if !proxy? && raw_data[:ignored] == true
    true
  else
    super
  end
end

#raw_dataHash

This page’s frontmatter without being enhanced for access by either symbols or strings. Used internally

Returns:

  • (Hash)


65
66
67
# File 'lib/middleman-core/core_extensions/front_matter.rb', line 65

def raw_data
  app.extensions[:frontmatter].data(source_file).first
end