New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index.md is generated in subfolder /index/index.html #3396

Closed
marcojakob opened this Issue Apr 26, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@marcojakob

marcojakob commented Apr 26, 2017

I've upgraded to Hugo v0.20.5 and the generated file location of the index.md files changed. I don't think this was intended. Here is what happened:

I use following content structure to keep content and images together:

├── content
│   └── blog
│       ├── my-blog-post-1
│       │   └── index.md
│       │   └── image-for-post-1.jpg

This generates the following structure:

Hugo before v0.20 (expected behavior)

This is how it should be.

├── public
│   └── blog
│       ├── my-blog-post-1
│       │   └── index.html
│       │   └── image-for-post-1.jpg

Hugo v0.20 (wrong behavior)

├── public
│   └── blog
│       ├── my-blog-post-1
│       │   └── image-for-post-1.jpg
│       │   └── index
│       │       └── index.html

I think it is not intended behavior to have an additional index subfolder (/index/index.html).

There is a workaround if I set slug = '/' in the front matter but I would rather not do that.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Apr 26, 2017

Member

Thanks for getting in touch, but it feels like this is a question that would be better suited to the Hugo Discussion Forum. We prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug. You may also find the answers you search for in Hugo Documentation.

Member

bep commented Apr 26, 2017

Thanks for getting in touch, but it feels like this is a question that would be better suited to the Hugo Discussion Forum. We prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug. You may also find the answers you search for in Hugo Documentation.

@bep bep closed this Apr 26, 2017

@marcojakob

This comment has been minimized.

Show comment
Hide comment

@bep bep reopened this Apr 27, 2017

@bep bep added the Bug label Apr 27, 2017

@bep bep added this to the v0.20.6 milestone Apr 27, 2017

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Apr 27, 2017

Member

I have slept on this, and we can fix easily this by saying that:

  • 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 the homepage'sindex.html (if enabled, and it usually is ...) or the index.html in the root of the section.
  • This "naming conflict" issue will not be a problem 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).
Member

bep commented Apr 27, 2017

I have slept on this, and we can fix easily this by saying that:

  • 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 the homepage'sindex.html (if enabled, and it usually is ...) or the index.html in the root of the section.
  • This "naming conflict" issue will not be a problem 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).

@bep bep self-assigned this Apr 27, 2017

bep added a commit to bep/hugo that referenced this issue Apr 27, 2017

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.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 gohugoio#3396

@bep bep closed this in #3401 Apr 27, 2017

bep added a commit that referenced this issue Apr 27, 2017

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.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

bep added a commit that referenced this issue Apr 27, 2017

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
@marcojakob

This comment has been minimized.

Show comment
Hide comment
@marcojakob

marcojakob Apr 27, 2017

Thank you very much @bep. That is a good fix 👍. When I get more fluent in Go programming, I will try contributing such things as pull requests myself.

marcojakob commented Apr 27, 2017

Thank you very much @bep. That is a good fix 👍. When I get more fluent in Go programming, I will try contributing such things as pull requests myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment