How to render language subdirectories in subdirectory, not in root of the public folder?

I need to render everything in public/pricing subdirectory. I am using i18n for multilanguage. For now, I have all the content, css and js folders rendered in /pricing subdirectory, but languages are in the root. So when I switch langauge to spanish for example, the link is /es/pricing/, and I need it to be /pricing/es/.

How do I achieve that?

[languages.es]
    languageName = 'Español'
    contentDir = "content/pricing/es"
    flag = "flag-es"
    languageCode = "es"

You need to set the baseURL to e.g.:

baseURL = "https://www.example.com/pricing"

Note that you will probably need to adjust something other than that to get where you want, but it will probably simplify things.

I did do that at first, but I need everything rendered in /public/pricing/… because I’m sending rendered public folders to the hosting team that host it on aws s3 and I need everything to be in pricing subfolder. Can I manually move it after rendering?
Thank you upfront @bep

hat host it on aws s3 and I need everything to be in pricing subfolder.

I think most (all?) s3 tools support setting a bucket root/path.

I suspect that you can configure and use hugo deploy to publish this to s3:

Or you can use

s3deploy -source=public/ -region=eu-west-1 -bucket=mybucket.com -path pricing --public-access

Thank you for that information. I will relay it to the team responsible for handling hosting matters.

1 Like