diff --git a/CHANGELOG.md b/CHANGELOG.md index 497650e6..4aeb089e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ Master === +* Give file metadata (such as frontmatter) precedence over path meta. #552 * Add `sass_assets_paths` option for arbitrary sass partial locations. * Don't catch CoffeeScript errors when in build mode. * Extract load_paths so they aren't locked into the binary diff --git a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb index 6529f56e..fde75080 100644 --- a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb +++ b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb @@ -37,7 +37,7 @@ module Middleman::CoreExtensions %w(layout layout_engine).each do |opt| data[opt.to_sym] = fmdata[opt] unless fmdata[opt].nil? end - + { :options => data, :page => fmdata } end end diff --git a/middleman-core/lib/middleman-core/sitemap/resource.rb b/middleman-core/lib/middleman-core/sitemap/resource.rb index c7236c74..ff0af91b 100644 --- a/middleman-core/lib/middleman-core/sitemap/resource.rb +++ b/middleman-core/lib/middleman-core/sitemap/resource.rb @@ -54,13 +54,13 @@ module Middleman # Get the metadata for both the current source_file and the current path # @return [Hash] def metadata - result = store.metadata_for_file(source_file).dup - - path_meta = store.metadata_for_path(path).dup - if path_meta.has_key?(:blocks) - result[:blocks] << path_meta.delete(:blocks) + result = store.metadata_for_path(path).dup + + file_meta = store.metadata_for_file(source_file).dup + if file_meta.has_key?(:blocks) + result[:blocks] << file_meta.delete(:blocks) end - result.deep_merge!(path_meta) + result.deep_merge!(file_meta) local_meta = @local_metadata.dup if local_meta.has_key?(:blocks) @@ -114,7 +114,7 @@ module Middleman return File.open(source_file).read unless template? relative_source = Pathname(source_file).relative_path_from(Pathname(app.root)) - + instrument "render.resource", :path => relative_source do md = metadata.dup opts = md[:options].deep_merge(opts)