diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index a5b58897..4c9d5dfc 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -45,6 +45,8 @@ module Jekyll index.htm index.html index.rhtml + index.xht + index.xhtml index.cgi index.xml index.json diff --git a/lib/jekyll/commands/serve/servlet.rb b/lib/jekyll/commands/serve/servlet.rb index b25f1d9d..ec528fa6 100644 --- a/lib/jekyll/commands/serve/servlet.rb +++ b/lib/jekyll/commands/serve/servlet.rb @@ -140,7 +140,9 @@ module Jekyll end def search_index_file(req, res) - super || search_file(req, res, ".html") + super || + search_file(req, res, ".html") || + search_file(req, res, ".xhtml") end # Add the ability to tap file.html the same way that Nginx does on our @@ -149,7 +151,9 @@ module Jekyll def search_file(req, res, basename) # /file.* > /file/index.html > /file.html - super || super(req, res, "#{basename}.html") + super || + super(req, res, "#{basename}.html") || + super(req, res, "#{basename}.xhtml") end # rubocop:disable Naming/MethodName diff --git a/test/fixtures/webrick/bar/foo.xhtml b/test/fixtures/webrick/bar/foo.xhtml new file mode 100644 index 00000000..6890fdca --- /dev/null +++ b/test/fixtures/webrick/bar/foo.xhtml @@ -0,0 +1 @@ +Content of foo.xhtml diff --git a/test/test_commands_serve_servlet.rb b/test/test_commands_serve_servlet.rb index 1f84cbbb..0ccc49b3 100644 --- a/test/test_commands_serve_servlet.rb +++ b/test/test_commands_serve_servlet.rb @@ -34,5 +34,15 @@ class TestCommandsServeServlet < JekyllUnitTest assert_equal("404", response.code) end end + + should "find xhtml file" do + get("/bar/foo") do |response| + assert_equal("200", response.code) + assert_equal( + 'Content of foo.xhtml', + response.body.strip + ) + end + end end end