Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultContentLanguageInSubdir and links in languages.toml #246

Closed
strauhmanis opened this issue May 10, 2023 · 2 comments
Closed

defaultContentLanguageInSubdir and links in languages.toml #246

strauhmanis opened this issue May 10, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@strauhmanis
Copy link

strauhmanis commented May 10, 2023

Is your feature request related to a problem? Please describe
The problem is that the functioning of the option defaultContentLanguageInSubdir depends on the hardcoded into languages.toml links (i.e. "/en/about").

Describe the solution you'd like
Although, I do not know whether there is or is no limitation with the Hugo to arrive at this specific solution, my description of it is as follows:

Perhaps, and in the example of the "/en/about" link, it could be possible for the "en" part to be generated dynamically depending on the high-level definition in the languages.toml (i.e. "[en]" and "[nl]" and "[mylang]"), and depending on whether the defaultContentLanguageInSubdir option is true or false, as well as depending on the weight.

Describe alternatives you've considered
As is now, the alternative to the proposed solution, is to change the hardcoded links by hand whenever the defaultContentLanguageInSubdir is set to true or false and whenever language's weight is altered.

Additional context
Please see the attached screenshot in respect to the proposed solution.

Screenshot

@strauhmanis strauhmanis added the enhancement New feature or request label May 10, 2023
@markdumay
Copy link
Collaborator

Thanks for pointing this out, I agree the current configuration is kind of messy. I submitted a new release to fix this, see this PR for the changes. All URLs should now be decoupled from the language configuration. Let me know if this behaves as expected.

Regarding the contentDir, this depends on your specific Hugo configuration. You can organize content translations by either content directory or by filename. Hinode uses organization by content directory as an example, but you should be able to adjust this in your own project as desired.

@strauhmanis
Copy link
Author

Thank you very much, Mark!
The change you introduced is excellent and behaves as excepted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants