lib/siteleaf/server.rb in siteleaf-0.9.3 vs lib/siteleaf/server.rb in siteleaf-0.9.5

- old
+ new

@@ -10,21 +10,25 @@ def resolve_template(url = "/") path = url.gsub(/\/\z|\A\//, '') #strip beginning and trailing slashes paths = path.split("/") templates = [] - if path == "" - templates.push("index.html") + if ['sitemap.xml','feed.xml'].include?(path) + templates.push(path) else - templates.push("#{paths.join('/')}.html") - templates.push("#{paths.join('/')}/index.html") - templates.push("#{paths.join('/')}/default.html") - while paths.size > 0 - paths.pop - templates.push("#{paths.join('/')}/default.html") if paths.size > 0 + if path == "" + templates.push("index.html") + else + templates.push("#{paths.join('/')}.html") + templates.push("#{paths.join('/')}/index.html") + templates.push("#{paths.join('/')}/default.html") + while paths.size > 0 + paths.pop + templates.push("#{paths.join('/')}/default.html") if paths.size > 0 + end end + templates.push("default.html") end - templates.push("default.html") templates.each do |t| return File.read(t) if File.exist?(t) end \ No newline at end of file