slug does not seam to work for leaf pages. This is my setup:
│ ├── index.md
│ ├── index.fr.md
│ ├── index.de.md
index.de.md contains this front matter:
slug = "kontakt"
Yet, this page is rendered:
page = "/:slug/"
does not change the URL.
- I would like to avoid
translationKey. This can get tricky.
- It would be great to have all related content in one folder—including page resources. Therefore I am trying to avoid e. g.
contact.de.md in the root folder.
post = "/:section/:slug"
page = "/:slug"
With the latest hugo, it’s working for me. Did you try:
contact = "/:slug/"
That’s a very clever hack.
It also allows (simulating) deep nesting/subfolders of leaf pages—a feature I always missed(*). The only disadvantage maybe is that you need to slugify all leaf pages.
Yes, I had tried
contact = "/:slug/", but it did not work—and the site is far too big for this.
(*) My hack for deep nesting was using _index.md files in subfolders with front matter
layout = "single". Your hack is a lot more out of the box!