Added fix for empty YAML
This commit is contained in:
parent
1439241661
commit
85f06ccecd
|
@ -70,3 +70,14 @@ Feature: YAML Front Matter
|
||||||
"""
|
"""
|
||||||
When I go to "/front-matter-change.html"
|
When I go to "/front-matter-change.html"
|
||||||
Then I should see "Hola Mundo"
|
Then I should see "Hola Mundo"
|
||||||
|
|
||||||
|
Scenario: A template should handle an empty YAML feed
|
||||||
|
Given the Server is running at "frontmatter-app"
|
||||||
|
And the file "source/front-matter-change.html.erb" has the contents
|
||||||
|
"""
|
||||||
|
---
|
||||||
|
---
|
||||||
|
Hello World
|
||||||
|
"""
|
||||||
|
When I go to "/front-matter-change.html"
|
||||||
|
Then I should see "Hello World"
|
||||||
|
|
|
@ -31,7 +31,7 @@ module Middleman::CoreExtensions
|
||||||
)
|
)
|
||||||
|
|
||||||
sitemap.provides_metadata do |path|
|
sitemap.provides_metadata do |path|
|
||||||
fmdata = frontmatter_manager.data(path).first
|
fmdata = frontmatter_manager.data(path).first || {}
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
%w(layout layout_engine).each do |opt|
|
%w(layout layout_engine).each do |opt|
|
||||||
|
@ -158,7 +158,7 @@ module Middleman::CoreExtensions
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def manipulate_resource_list(resources)
|
def manipulate_resource_list(resources)
|
||||||
resources.each do |r|
|
resources.each do |r|
|
||||||
if !r.proxy? && r.data["ignored"] == true
|
if !r.proxy? && !r.data.nil? && r.data["ignored"] == true
|
||||||
r.frontmatter_ignored = true
|
r.frontmatter_ignored = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue