Skip to content
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 · 5 comments · Fixed by #3401
Closed

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

marcojakob opened this issue Apr 26, 2017 · 5 comments · Fixed by #3401
Assignees
Milestone

Comments

@marcojakob
Copy link

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
Copy link
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 as completed Apr 26, 2017
@marcojakob
Copy link
Author

@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
Copy link
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
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 as completed in #3401 Apr 27, 2017
bep added a commit that referenced this issue Apr 27, 2017
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
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
Copy link
Author

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.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants