Multilingual sub-section permalink config

I’ve had no problem setting the permalink config for top-level sections:

[languages.es.permalinks]
  projects = "proyectos/:slug/"

But now I want to do the same for sub-sections and I can’t find a syntax that is supported. I’ve tried:

[languages.es.permalinks]
  projects = "proyectos/:slug/"
  "projects/acting" = "proyectos/actuación/:slug/"
[languages.es.permalinks]
  projects = "proyectos/:slug/"
  "projects\\acting" = "proyectos/actuación/:slug/"
[languages.es.permalinks]
  projects = "proyectos/:slug/"
  "projects.acting" = "proyectos/actuación/:slug/"
[languages.es.permalinks]
  projects = "proyectos/:slug/"
  acting = "proyectos/actuación/:slug/"
[languages.es.permalinks]
  projects = "proyectos/:slug/"
  [languages.es.permalinks.projects]
    acting = "proyectos/actuación/:slug/"

Is this supported? It seems strange to allow the creation of sub-sections but not the configuration of sub-section permalinks.

Have you tried searching this forum?

1 Like

Yes, and that thread was inconclusive.

Well, please rephrase or clarify your question then.

Because “permalinks configuration is section wide” looks like a very specific answer to your “is this supported?” to me. Really hard to get more conclusive than that, you know…

Certainly.

Consider a content directory like this:

content
 ↳ blog
    ↳ post-1.md
    ↳ post-1.es.md
    ↳ ...
 ↳ projects
    ↳ _index.md
    ↳ _index.es.md
    ↳ acting
       ↳ _index.md
       ↳ _index.es.md
       ↳ film-1.md
       ↳ film-1.es.md
       ↳ ...
    ↳ cartoons
       ↳ _index.md
       ↳ _index.es.md
       ↳ cartoon-1
          ↳ index.md
          ↳ index.es.md
       ↳ ...

I want /content/projects/acting/film-1.es.md to be served at mysite.com/es/proyectos/actuación/película-1/, and similarly the rest of the pages. I have no trouble setting the Spanish permalink patterns for blog and projects. I can’t figure out how to set the Spanish permalink patterns for acting and cartoons.

Permalinks configuration is section wide.

The word “section” can be interpreted to include blog, projects, acting, and cartoons. It can also be interpreted to include only blog and projects. I don’t know which interpretation matches Hugo’s behaviour.

Anyway, the best solution I’ve come up with so far is tedious and error-prone: I set url in the front matter of every .es.md file.

+++
title = "Película 1"
url = "proyectos/actuación/película-1/"
+++

My question: can I do this the way I hope to do it (once per directory in the site config)? If not, is there a method better than my current work-around?

No. “Blog” and “projects” are sections, “acting” and “cartoons” are subsections of the “projects” section.

Not that I know of, sorry.