pass default front matter directly to the merge
This commit is contained in:
parent
61567f430e
commit
c6790bd8c9
5
Rakefile
5
Rakefile
|
@ -93,13 +93,12 @@ def siteify_file(file, front_matter = {})
|
||||||
title = contents.match(/\A# (.*)$/)[1]
|
title = contents.match(/\A# (.*)$/)[1]
|
||||||
output_file = file.sub(/\.markdown\z/, ".md").downcase
|
output_file = file.sub(/\.markdown\z/, ".md").downcase
|
||||||
slug = File.basename(output_file, ".md")
|
slug = File.basename(output_file, ".md")
|
||||||
default_frontmatter = {
|
front_matter = front_matter.merge({
|
||||||
"title" => title,
|
"title" => title,
|
||||||
"layout" => "docs",
|
"layout" => "docs",
|
||||||
"permalink" => "/docs/#{slug}/",
|
"permalink" => "/docs/#{slug}/",
|
||||||
"note" => "This file is autogenerated. Edit /#{file} instead."
|
"note" => "This file is autogenerated. Edit /#{file} instead."
|
||||||
}
|
})
|
||||||
front_matter = front_matter.merge(default_frontmatter)
|
|
||||||
contents.gsub!(/\A# #{title}\n\n?/, "")
|
contents.gsub!(/\A# #{title}\n\n?/, "")
|
||||||
contents = converted_history(contents) if output_file == "history.md"
|
contents = converted_history(contents) if output_file == "history.md"
|
||||||
contents = "#{front_matter.to_yaml}---\n\n#{contents}"
|
contents = "#{front_matter.to_yaml}---\n\n#{contents}"
|
||||||
|
|
Loading…
Reference in New Issue