Overhaul content-type handling, making it configurable via page/proxy commands as well as frontmatter with the 'content_type' parameter.

Now, users can set content type explicitly for their files in a number of ways, or rely on automatic file-extension content types. Proxied files default to automatic file-extension content types, but then fall back to the content type of the resource they proxy to. There is also a bug fixed around correctly setting content type inside send_file. Fixes #821.
This commit is contained in:
Ben Hollis 2013-04-06 14:05:26 -07:00
parent 397ccd2c1e
commit 7a4aa109a6
15 changed files with 118 additions and 53 deletions

View file

@ -185,6 +185,15 @@ module Middleman::CoreExtensions
def data
::Middleman::Util.recursively_enhance(raw_data).freeze
end
# Override Resource#content_type to take into account frontmatter
def content_type
# Allow setting content type in frontmatter too
fm_type = data[:content_type]
return fm_type if fm_type
super
end
end
module InstanceMethods