-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Allow "smart merging of config" for language specific configs. #10620
Comments
I think the current behavior is correct, and it makes sense to me. A language key has greater specificity than a root key (similar to the way CSS rules work). You can see how this works, even without a theme. Without a language params table:
With a language params table, but without any key/value pairs:
With a populated language params table:
|
I understand that language config has higher priority than the normal config. To make it clearer, what I would like to see is the ability to set [params.comments]
color = "aaa"
title = "xxx"
[[language.en]]
[language.en.params.comments]
title = "yyy" In the current behavior, the |
Might be related to #10208. For both Line 443 in c4f3a46
But might be unrelated as well, as there is special handling for language based configuration in the merge logic: hugo/config/defaultConfigProvider.go Line 234 in c4f3a46
|
@cmpute I agree that we should do this. As @istr has pointed out, the probable reason why this isn't working as you expect today is that we the params language merging isn't currently a part of the "total config merge", but a shallow merge done when you use this for a given language. I have a branch where I'm currently consolidating all config into one struct (mostly for documentation purposes), but it should also allow me to improve on this. |
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes gohugoio#10896 Closes gohugoio#10620
Huge thanks for solving this. Now I am ready to significant simplify my dual-language blog config files 😄 |
@istr thanks; fun story: Sunday when I was almost done I thought, I'm going to run some benchmarks just to make sure I haven't messed up ... Turned out everything was about 20% slower and more memory hungry. It, of course, had a simple explanation (reparsing of the Go templates for each site), but it was a moment there where I almost threw in the towel :-) |
Oh yes, this kind of moment. I know it only too well... |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Choosing how the config is merged between user config and theme config is supported by #8633, but the merge between language specific config and base config seems to be not supported.
If I have a theme config
then a language specific config
then the color config will not be merged into the final config of that language. Maybe it's feasible but just I don't know how to.
The text was updated successfully, but these errors were encountered: