Allow static files in collections
Allow Documents to be static files so static files can exist in collections
This commit is contained in:
parent
7e2298b8d0
commit
274c6d3667
|
@ -80,12 +80,19 @@ module Jekyll
|
|||
%w[.sass .scss .coffee].include?(extname)
|
||||
end
|
||||
|
||||
# Determine whether the document has a YAML header.
|
||||
#
|
||||
# Returns true if the file starts with three dashes
|
||||
def has_yaml_header?
|
||||
!!(File.open(path, 'rb') { |f| f.read(5) } =~ /\A---\r?\n/)
|
||||
end
|
||||
|
||||
# Determine whether the file should be rendered with Liquid.
|
||||
#
|
||||
# Returns false if the document is either an asset file or a yaml file,
|
||||
# true otherwise.
|
||||
def render_with_liquid?
|
||||
!(asset_file? || yaml_file?)
|
||||
!(asset_file? || yaml_file?) && has_yaml_header?
|
||||
end
|
||||
|
||||
# Determine whether the file should be placed into layouts.
|
||||
|
@ -93,7 +100,7 @@ module Jekyll
|
|||
# Returns false if the document is either an asset file or a yaml file,
|
||||
# true otherwise.
|
||||
def place_in_layout?
|
||||
!(asset_file? || yaml_file?)
|
||||
!(asset_file? || yaml_file?) && has_yaml_header?
|
||||
end
|
||||
|
||||
# The URL template where the document would be accessible.
|
||||
|
@ -189,7 +196,7 @@ module Jekyll
|
|||
unless defaults.empty?
|
||||
@data = defaults
|
||||
end
|
||||
@content = File.read(path, merged_file_read_opts(opts))
|
||||
@content = File.open(path, "rb") { |f| f.read }
|
||||
if content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
||||
@content = $POSTMATCH
|
||||
data_file = SafeYAML.load($1)
|
||||
|
|
Loading…
Reference in New Issue