Template talk:Navbox

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Navboxes and Sidebars usage guidance[edit]

Hello there. I have been editing and creating Navboxes and Sidebars for a while, and I have a sense for when is better to use each. However, I was wondering if more spelled-out guidelines, or essays on the topic exist. If no guidance exists, I am not suggesting that it should; not everything needs to be spelled out. However, if it does exist, I would be interested to know and read it. One final note: THANK YOU to whoever established and developed them in Wikipedia. They are invaluable in finding articles and bringing order and structure to Wikipedia. Thank you!(talk) user:Al83tito 16:20, 6 July 2018 (UTC)

user:Al83tito, you may wish to start by reviewing WP:NAVBOX and the various links at the top of that section. Frietjes (talk) 18:32, 6 July 2018 (UTC)

Adding a "style links" parameter[edit]

Module:Team roster navbox is a wrapper for Module:Navbox that does two extra things (1) adds |nowraplinks=yes and (2) automatically applies background/color styling to the title, above, group, and below fields. the first feature is trivial, but the second feature is rather useful. for example, compare

{{team roster navbox
| name = Template talk:Navbox
| title = [[Template:Navbox]]
| titlestyle = background-color:black; color:white;
}}

and

{{navbox
| name = Template talk:Navbox
| title = [[Template:Navbox]]
| titlestyle = background-color:black; color:white;
}}

if there are no objections, I would like to add this link coloring feature to Module:Navbox directly. it would be turned on using |stylelinks=yes parameter, which means "apply the parent element background and color style parameter to the text inside the links". comments? suggestions? Frietjes (talk) 19:11, 9 July 2018 (UTC)

you can see some proposed code here. Frietjes (talk) 19:40, 9 July 2018 (UTC)
@Frietjes: What about WP:COLOUR? Should the navbox only do this for titles / other fields which consist solely of links and whitespace? Jc86035 (talk) 22:16, 9 July 2018 (UTC)
Jc86035, I believe the key here is that it would be optional and could be tracked. the alternative see this search is what you see in Template:Miami Dolphins roster navbox which is to color the links manually. I don't see how we are going to stop users from overriding the link coloring. Frietjes (talk) 22:23, 9 July 2018 (UTC)

TemplateStyles in meta templates[edit]

Followers of this page may be interested in WT:TemplateStyles#In the context of meta templates. Please take a moment to comment there. --Izno (talk) 01:38, 27 July 2018 (UTC)

Module:Navbox[edit]

Not sure if this is a flaw... I noted that Module:Navbox places some navbars into at least one category incorrectly. An example is at {{Dynamics (music)}}, where the navbar does not style any other than the default bg, and yet because {{Aspects of music}}, which does style a non-default bg, is installed on "Template Dynamics (music)'s" /doc page, that template populates Category:Navboxes using background colours incorrectly. Tried using |nocat=true and |nocat=yes in the "Aspects of music" template on the /doc page, but that doesn't work (each time I tried a purge and a null edit). Since I have not yet mastered Lua, I'm at a loss as to how to fix this. Can anyone help?  Paine Ellsworth  put'r there  19:43, 20 August 2018 (UTC)

Also, I did remove the "Aspects of music" navbar from the /doc page, which did remove the "Dynamics (music)" navbar from the category.  Paine Ellsworth  put'r there  19:47, 20 August 2018 (UTC)

Module:Navbox has no method of disabling categories (there is no nocat). It uses mw.title.getCurrentTitle() to get the title of the page being rendered. That page is Template:Dynamics (music). The module then tests if the page is in the Template namespace and, if so, whether it should be ignored (doc/sandbox/testcases). If it is a not-ignored template page, it gets a tracking category if needed. That is why the tracking category is added to Template:Dynamics (music) but not its /doc subpage (the latter is ignored as a doc page). I think I once tweaked the code which generates the tracking categories but I did not change the logic. As you point out, that logic is somewhat broken, because the aim apparently is to flag templates which use a navbox in certain dubious ways, whereas in this case the dubious usage is in the doc subpage. I can't see a quick fix. I could look at adding nocat if others agree that would be desirable, however, {{Aspects of music}} would also need an edit to pass the nocat parameter to {{Navbox}}. Johnuniq (talk) 05:45, 21 August 2018 (UTC)
There might be good reason to include a fix for this. The category is populated by over 56,000 templates, and I wonder how many of those are like {{Dynamics (music)}} and shouldn't be in there. It would be best if the fix would not include default bg templates in the category without having to use a nocat param at the /doc pages. A "seamless" fix. I don't think there was a way to do that even before Lua came along. So a nocat param appears to be the only way to fix this. Then each entry in that category will have to be checked and the nocat param added to the templates that shouldn't be there.  Paine Ellsworth  put'r there  17:26, 21 August 2018 (UTC)
I implemented nocat using the guideline at WP:NOCAT. I got thoroughly confused about the logic for a while, but I think it's correct now. One source of confusion was that Module:Navbox uses Module:Arguments with a default which means |nocat= is removed from the arguments whereas WP:NOCAT recommends that should be the same as |nocat=true. Currently (and saner IMHO), if |nocat= is used, a tracking category will be added if warranted. I added |nocat=true to Template:Aspects of music with the result that Template:Dynamics (music) is no longer showing the tracking category. Johnuniq (talk) 05:11, 22 August 2018 (UTC)
Thank you for that. One thing though... your edit removed {{Aspects of music}} from the category, and that template should be in the category. So I altered it to |nocat = {{{nocat|}}}, which allows "nocat" to be passed on to the instances of the template on /doc pages, and keeps those templates out of the category when they have only the default background color.  Paine Ellsworth  put'r there  05:42, 22 August 2018 (UTC)
Thanks, I was really confused and wondered about that. Please test some more! Johnuniq (talk) 06:04, 22 August 2018 (UTC)
Also found that if I pass |nocat=true to /doc pages of other non-default bg navbars, those navbars will still populate the category as they should. And if for any reason they are changed back to the default bg in the future, the nocat will kick in and withdraw them from the category. I will start checking the category for other similar instances – I'll see if I can find a way to quickly AWB- check 'em. Thanks again, Johnuniq for your help on this!  Paine Ellsworth  put'r there  11:21, 22 August 2018 (UTC)
To Johnuniq: found a way to use AWB to sample more than 5,000 of the category entries and found none that were not supposed to be there. So the problem doesn't seem to be a very large one at all, seemingly limited to the few templates already found and fixed. Thank you again for your great help with this!  Paine Ellsworth  put'r there  14:32, 22 August 2018 (UTC)