-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
tpl: Fix indeterminate template lookup with templates with and withou… …t lang #13637
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
Conversation
|
I expect this test will pass because the first two rows of the table in this comment are constant. |
I obviously don't understand your failing test case, then. Oh, well, it's open source, maybe someone else will. |
| {"nn", "all.en.html", "all.nn.html", "single.html", "single.html", "single.html", ""}, | ||
| {"nn", "all.en.html", "all.nn.html", "single.nn.html", "single.nn.html", "single.nn.html", ""}, | ||
| {"nn", "single.json", "single.nn.json", "all.json", "", "", "single.nn.json"}, | ||
| {"nn", "single.json", "single.en.json", "all.nn.json", "", "", "single.json"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmooring OK, so I finally understood what the issue was about, and you were right, there were some issues to be fixed. I'm not sure if the above table matches your table, but it's stable. The only question I had after this was the line above:
{"nn", "single.json", "single.en.json", "all.nn.json", "", "", "single.json"},
For lang nn we now prefer single.json over all.nn.json, which in my head makes the most sense, but I'm not entirely sure.
Anyway, thanks for the bug report (I thought we had decent test coverage on this ....), and I would appreciate if you could take this branch for a spin.
|
Thanks for looking into this. I'm glad you were able to find the problem. Initial testingThe lookup order (highest to lowest specificity) is now stable: Regarding your question:
I suppose you could argue either way, but I would leave it as is. The behavior is easily described: page kind and layout standard have higher specificity than language. Terminology guidanceI would appreciate your guidance regarding terminology. Technically we are "weighting" various factors. When we describe weighting behavior with pages, menu entries, output formats, and sites, we say "the heavier items sink to the bottom while the lighter items float to the top." So, instead of using words like "specificity "or "priority", should we use the word "weight"? If yes, would it make sense to present list examples like the one above in order of lightest (top) to heaviest (bottom), meaning the first chosen would be at the bottom of the list? That's the opposite of the way we present these list today. My guess is that we will end up using both "weight" (and its derivatives) and "specific" (and its derivatives) together. Thoughts? Adding front matter "layout" to the mixWhen I add a The bit above the line doesn't look right to me. At a minimum, I don't think there should be any "list" templates in the lookup order for rendering a regular page. But even if you remove those, the weighting above the line seems to different than the weighting below the line. |
I'm not sure how you determine the "lookup order" in the above. The thing is,
I'm in the process of undoing the mess I created with the dot vs the content files/resources, but I'm not prepared to doing any drastic with the above. In Hugo <= 0.45 we
Now we:
As to documentation and your example:
My general thought here is that we could use the two terms And instead of "ordered lists" I think it would be more useful with.
As to 3) I guess there are a couple things that's useful to know:
Not sure how useful the above is, but I guess it's my 50 cents about this at the moment. |
Closes #13636