actually use the handy dandy :index_file param we have
This commit is contained in:
parent
5602e35c88
commit
6f8715360c
1 changed files with 7 additions and 4 deletions
|
@ -5,20 +5,23 @@ module Middleman::Features::DirectoryIndexes
|
|||
app.extend ClassMethods
|
||||
|
||||
app.build_reroute do |destination, request_path|
|
||||
indexed_path = request_path.gsub(/\/$/, "") + ".html"
|
||||
index_ext = File.extname(app.settings.index_file)
|
||||
new_index_path = "/#{app.settings.index_file}"
|
||||
|
||||
indexed_path = request_path.gsub(/\/$/, "") + index_ext
|
||||
|
||||
if app.settings.ignored_directory_indexes.include?(request_path)
|
||||
false
|
||||
else
|
||||
[
|
||||
destination.gsub(/\.html$/, "/index.html"),
|
||||
request_path.gsub(/\.html$/, "/index.html")
|
||||
destination.gsub(/#{index_ext.gsub(".", "\\.")}$/, new_index_path),
|
||||
request_path.gsub(/#{index_ext.gsub(".", "\\.")}$/, new_index_path)
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
app.before do
|
||||
indexed_path = request.path_info.gsub(/\/$/, "") + ".html"
|
||||
indexed_path = request.path_info.gsub(/\/$/, "") + File.extname(app.settings.index_file)
|
||||
|
||||
if !settings.ignored_directory_indexes.include?(indexed_path)
|
||||
parts = request.path_info.split("/")
|
||||
|
|
Loading…
Reference in a new issue