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

multihost: Console displays wrong language key when running hugo server #12564

Open
jmooring opened this issue Jun 3, 2024 · 1 comment
Open
Labels
Milestone

Comments

@jmooring
Copy link
Member

jmooring commented Jun 3, 2024

This isn't anything recent... the problem has been present since v0.119.0.

Background

In a multihost configuration, when you run hugo server, the console displays something like:

Web Server is available at http:https://localhost:1313/ (bind address 127.0.0.1) en
Web Server is available at http:https://localhost:1314/ (bind address 127.0.0.1) de

We added the language key to the end of each line in v0.119.0 via #11442.

Problem

If the default content language does not correspond to the first site by weight (or language key fallback), the wrong language key is displayed at the end of each line.

Example

defaultContentLanguage = 'en'

[languages.de]
baseURL = 'https://de.example.org/'
weight = 1

[languages.en]
baseURL = 'https://en.example.org/'
weight = 2

When I run hugo server I see this in the console:

Web Server is available at http:https://localhost:1314/ (bind address 127.0.0.1) en
Web Server is available at http:https://localhost:1313/ (bind address 127.0.0.1) de

But http:https://localhost:1314/ is serving the DE site, while http:https://localhost:1313/ is serving the EN site.


Commentary

It seems like this, and similar areas of the code base, would be a lot simpler if the default content language were hardcoded to the the lightest weighted/sorted language. I guess I've never understood the use case for the configuration above.

@bep bep removed the NeedsTriage label Jun 4, 2024
@bep bep added this to the v0.127.0 milestone Jun 4, 2024
@bep
Copy link
Member

bep commented Jun 4, 2024

would be a lot simpler if the default content language were hardcoded to the the lightest weighted/sorted language.

I think this mostly comes from a time where we needed the value of defaultContentLanguage before we had bult the languages/sites slice.

But the above slice also defines the default sort order of languages (as seen in .AllTranslations) used in language selectors, so it's not a strange requirement to be able to control. that order independently from defaultContentLanguage.

@bep bep modified the milestones: v0.127.0, v0.128.0 Jun 8, 2024
@bep bep modified the milestones: v0.128.0, v0.129.0 Jun 21, 2024
@bep bep modified the milestones: v0.129.0, v0.131.0 Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants