Make templates extensions with layouts configurable
This commit is contained in:
parent
9553796731
commit
0c29fd4abf
3 changed files with 7 additions and 2 deletions
|
@ -20,6 +20,7 @@ master
|
|||
* Show an error message when git CLI is not available. #1765
|
||||
* Correctly show file names of GZIP'ed assets. #1364
|
||||
* Build file output is not parallel-ized! Use `middleman build --no-parallel` to disable.
|
||||
* Make template file extensions that get layouts by default configurable via `config[:extensions_with_layout]`
|
||||
|
||||
# 4.0.0
|
||||
|
||||
|
|
|
@ -149,9 +149,13 @@ module Middleman
|
|||
define_setting :http_prefix, '/', 'Default prefix for building paths'
|
||||
|
||||
# Default layout name
|
||||
# @return [String, Symbold]
|
||||
# @return [String]
|
||||
define_setting :layout, :_auto_layout, 'Default layout name'
|
||||
|
||||
# Which file extensions have a layout by default.
|
||||
# @return [Array.<String>]
|
||||
define_setting :extensions_with_layout, %w(.html .xhtml .php), 'Which file extensions have a layout by default.'
|
||||
|
||||
# Default string encoding for templates and output.
|
||||
# @return [String]
|
||||
define_setting :encoding, 'utf-8', 'Default string encoding for templates and output'
|
||||
|
|
|
@ -138,7 +138,7 @@ module Middleman
|
|||
locs[:current_path] ||= destination_path
|
||||
|
||||
# Certain output file types don't use layouts
|
||||
opts[:layout] = false if !opts.key?(:layout) && ext != '.html'
|
||||
opts[:layout] = false if !opts.key?(:layout) && !@app.config.extensions_with_layout.include?(ext)
|
||||
|
||||
renderer = ::Middleman::TemplateRenderer.new(@app, file_descriptor[:full_path].to_s)
|
||||
renderer.render(locs, opts)
|
||||
|
|
Loading…
Reference in a new issue