Merge pull request #1414 from stevenosloan/feature/support_sidecar_frontmatter_for_proxied_resources
add support for “sidecar” frontmatter at the destination url of proxied resources
This commit is contained in:
commit
ceeb93d0e4
|
@ -149,3 +149,22 @@ Feature: Neighboring YAML Front Matter
|
||||||
Then I should see "Layout in use: Override"
|
Then I should see "Layout in use: Override"
|
||||||
When I go to "/page_mentioned.html.erb.frontmatter"
|
When I go to "/page_mentioned.html.erb.frontmatter"
|
||||||
Then I should see "File Not Found"
|
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"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# Proxy ignored.html, which should ignore itself through a frontmatter
|
# Proxy ignored.html, which should ignore itself through a frontmatter
|
||||||
page 'proxied.html', :proxy => 'ignored.html'
|
page 'proxied.html', :proxy => 'ignored.html'
|
||||||
|
page 'proxied_with_frontmatter.html', :proxy => 'ignored.html'
|
||||||
page 'override_layout.html', :layout => :alternate
|
page 'override_layout.html', :layout => :alternate
|
||||||
page 'page_mentioned.html'
|
page 'page_mentioned.html'
|
||||||
|
|
|
@ -61,7 +61,14 @@ module Middleman::CoreExtensions
|
||||||
# @private
|
# @private
|
||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
def raw_data
|
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
|
end
|
||||||
|
|
||||||
# This page's frontmatter
|
# This page's frontmatter
|
||||||
|
|
Loading…
Reference in a new issue