hugolib: Avoid index.md in /index/index.html
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 27 Apr 2017 07:33:40 +0000 (09:33 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 27 Apr 2017 08:12:40 +0000 (10:12 +0200)
commit63b7ce151f7465fa2e616ce14aab1616fd004758
tree495fa20ea0b6338ea05174e77e6d2a4717b88961
parentb30ca4bec811dbc17e9fd05925544db2b75e0e49
hugolib: Avoid index.md in /index/index.html

Hugo 0.20 broke some sites that grouped their blog post and images together in subfolders.

This commit re-introduces that behaviour:

* If the file base name resolves to the same as the base name for the output type (i.e. "index" for HTML), the user probably meant it, so we treat that as an `uglyURL`, i.e. `my-blog-post-1/index..md`=> `/my-blog-post-1/index.html`
* The main use case for this is to group blog post and images together.
* Note that for the top level folder there will be a potential name conflict with a `section` `index.html` (if enabled)
* This issue will not be relevant for subfolders in sections
* Hugo will soon add support for nested sections, but we will have to find a way to separate them from the rest (`/content/_mysubsection` maybe).

Fixes #3396
hugolib/page_paths.go
hugolib/page_paths_test.go
hugolib/site_test.go