add support for “sidecar” frontmatter at the destination url of proxied resources
a “cheap” way to support adding data to pages created through `proxy` or `page` by adding frontmatter at the expected destination url. for example proxying a page to `/proxied.html`, by adding a sidecar frontmatter file at `source/proxied.html.frontmatter` (or source/proxied.frontmatter if directory indexes is activated) the frontmatter will be merged with the proxy source and available to `current_resource` at the destination.
This commit is contained in:
parent
4a59ebefe3
commit
85fa3fac02
3 changed files with 28 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue