diff options
author | Noah Campbell <noahcampbell@gmail.com> | 2013-09-25 08:24:49 +0400 |
---|---|---|
committer | Noah Campbell <noahcampbell@gmail.com> | 2013-09-25 08:27:25 +0400 |
commit | db50154e75cfb1100651b7521370f54a0695872e (patch) | |
tree | 51ada9876f7246cbd5608524d7a2d41dea570697 /target | |
parent | 4250bf8e3052da8178d5406390c4b455e5592148 (diff) |
Support index.html indexes in content directory
If a file named index.html exists in a directory, or root, it will be
rendered as if ugly urls are turned on. This allows for top level
content to not need a supporting layout file and content in content.
This change should not affect anyone who is using the perscribed way.
I also cleaned up a bunch of one off functions in site.go.
Diffstat (limited to 'target')
-rw-r--r-- | target/file.go | 2 | ||||
-rw-r--r-- | target/file_test.go | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/target/file.go b/target/file.go index 59281633a..0e48a93e5 100644 --- a/target/file.go +++ b/target/file.go @@ -73,7 +73,7 @@ func (fs *Filesystem) Translate(src string) (dest string, err error) { dir = path.Join(fs.PublishDir, dir) } - if fs.UglyUrls { + if fs.UglyUrls || file == "index.html" { return path.Join(dir, fmt.Sprintf("%s%s", name, ext)), nil } diff --git a/target/file_test.go b/target/file_test.go index 1ac1f3c79..258eae41c 100644 --- a/target/file_test.go +++ b/target/file_test.go @@ -10,7 +10,8 @@ func TestFileTranslator(t *testing.T) { expected string }{ {"/", "index.html"}, - {"index.html", "index/index.html"}, + {"index.html", "index.html"}, + {"bar/index.html", "bar/index.html"}, {"foo", "foo/index.html"}, {"foo.html", "foo/index.html"}, {"foo.xhtml", "foo/index.xhtml"}, |