Leaf Bundle: custom slug appended to bundle directory name

Hi there,

I’m toying around with the usage of custom slug in a Leaf Bundle.

It appears the custom slug is appended to the Leaf Bundle directory name.
Consider this:

# from about/services/misc.md
Title: What we do
slug: what-we-do/

The page will live at /about/services/what-we-do/ which is what we want.

Now, if I use a Page Bundle

# from about/services/misc/index.md
Title: What we do
slug: what-we-do/

Then, the page will live at /about/services/misc/what-we-do/ which is, for my part, not what I want. I want it to live at /about/services/what-we-do/ just like before switching to a bundle.

This can be solved by adding a custom url, but this is rather tedious, especially when you have to include the language code in there.

Speaking of languages, this becomes problematic when you use different content dir per language, and need to maintain translation files pairing while enforcing localized url. That’s when you will almost systematically need a custom slug.

Am I missing something on the usage of custom slugs? Forgive me if it’s already been discused, but I was not able to find anything in the discourse or the github issues.

cc @kaushalmodi, maybe you know what I’m doing wrong :slight_smile:

Hello! That definitely looks like a bug.

I don’t use slugs so I never came across this. I just set the permalinks to be the filenames (it will be the folder name containing the index.md in the case of leaf bundles):

  posts = "/:filename/"
  notes = "/notes/:filename/"

Thanks! https://github.com/gohugoio/hugo/issues/4870

1 Like