We are facing some issues while updating Hugo to v0.56. We think it has something to do with this issue.
Note: We have enabled uglyurls for our site and have not set any slugs.
Sample content folder structure:
Before v0.56, the output would be,
baseUrl/dir1/page1.html
baseUrl/dir1/page2/index.html
In v0.56, the output is,
baseUrl/dir1/page1.html
baseUrl/dir1/page2.html
Is the new one, the intended behavior? Anyways to retain the previous behavior?
Does this happens with the latest hugo v0.81.0 ? 0.56 is very outdated.
And we need to see your configuration and set up to be able to help more.
Thanks, @divinerites
We have checked this in the latest version of Hugo (0.81.0) as well.
Please find our sample Hugo site here in Github to see the configuration and output of the version (0.53) and version (0.81.0) to compare.
i didn’t tested it, but can you rename dir1/page2/index.md (bundle) to dir1/page2/_index.md so it is a regular page/section ?
see Page Bundles | Hugo
Yes.
Yes, but it is ugly, prone to user error, not future-proof, and will likely be a maintenance headache. Having said that:
- Rename
content/dir1/page2/index.md to content/dir1/page2/__index.md. Note that the new file name begins with two underscores. The file name is actually irrelevant, as long as it is neither index.md nor _index.md.
- Add
slug: index to the file’s front matter.
Credit to github.com/TjeuKayim.
If it were me, and I were transitioning a site from < v0.56 to v0.81, I would live with the new URLs, and create 301 redirects where needed. In the long run this one-time effort will be well worth the expense.
Thanks, @jmooring
I could see your solution will work. However, we are having a lot of similar pages and it will be hard to rename and add slug for everything.
Instead, we’re planning to add a URL param in the front matter which reduces almost half of the burden and it is familiar to us.
It worked @divinerites. As we have more pages like this, it will be hard to change and maintain everything.