diff --git a/middleman-core/features/front-matter-neighbor.feature b/middleman-core/features/front-matter-neighbor.feature index b420cba0..67eb3d16 100644 --- a/middleman-core/features/front-matter-neighbor.feature +++ b/middleman-core/features/front-matter-neighbor.feature @@ -149,3 +149,22 @@ Feature: Neighboring YAML Front Matter Then I should see "Layout in use: Override" When I go to "/page_mentioned.html.erb.frontmatter" Then I should see "File Not Found" + + Scenario: Neighbor frontmatter for destination of proxy resources + Given the Server is running at "frontmatter-settings-neighbor-app" + And the file "source/proxied_with_frontmatter.html.frontmatter" has the contents + """ + --- + title: Proxied title + --- + """ + And the file "source/ignored.html.erb" has the contents + """ + --- + ignored: true + --- + + <%= current_resource.data.title %> + """ + When I go to "/proxied_with_frontmatter.html" + Then I should see "Proxied title" diff --git a/middleman-core/fixtures/frontmatter-settings-neighbor-app/config.rb b/middleman-core/fixtures/frontmatter-settings-neighbor-app/config.rb index 74cda623..0285d071 100644 --- a/middleman-core/fixtures/frontmatter-settings-neighbor-app/config.rb +++ b/middleman-core/fixtures/frontmatter-settings-neighbor-app/config.rb @@ -1,4 +1,5 @@ # Proxy ignored.html, which should ignore itself through a frontmatter page 'proxied.html', :proxy => 'ignored.html' +page 'proxied_with_frontmatter.html', :proxy => 'ignored.html' page 'override_layout.html', :layout => :alternate page 'page_mentioned.html' 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 b7b099d3..4179fae0 100644 --- a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb +++ b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb @@ -61,7 +61,14 @@ module Middleman::CoreExtensions # @private # @return [Hash] def raw_data - app.extensions[:frontmatter].data(source_file).first + data = app.extensions[:frontmatter].data(source_file).first + + if proxy? + url_data = app.extensions[:frontmatter].data( File.join( app.source_dir, url ).chomp('/') ).first + data = data.deep_merge(url_data) + end + + data end # This page's frontmatter