Wikiwand AI

Wikipedia talk:WikiProject Templates

From Wikipedia, the free encyclopedia

Where to put styles.css of a template's sandbox?

There are two conventions that are in conflict when trying to decide where to put styles.css page of a template's sandbox:

  1. Every sandbox of page Template:Foo is located at Template:Foo/sandbox
  2. Every TemplateStyles page styles.css for a page Template:Foo is located at Template:Foo/styles.css

This means that if Template:Foo is styled with Template:Foo/styles.css, then styles.css of its sandbox Template:Foo/sandbox has two potential locations:

  1. Following the first convention: sandbox of Template:Foo/styles.css is at Template:Foo/styles.css/sandbox
  2. Following the second convention: styles.css of Template:Foo/sandbox is at Template:Foo/sandbox/styles.css

Which of the two options is preferable? —⁠andrybak (talk) 14:50, 18 April 2026 (UTC)

Notified: Template talk:Uses TemplateStyles, Wikipedia talk:TemplateStyles, Wikipedia:Village pump (technical). —⁠andrybak (talk) 14:57, 18 April 2026 (UTC)
According to Wikipedia:TemplateStyles, In general, this means that a style page should be a subpage of the related template, so the second convention is appropriate. If we're seeing a lot of this out in the wild, we should probably make sure everything is standardised. Primefac (talk) 14:56, 18 April 2026 (UTC)
I've been a bit confused about this myself. I think the issue here stems from a difference of interpretation of what the two copies of "styles.css" are for. There are two interpretations:
  1. The "styles.css" used by the template sandbox isn't for the live template at Template:Foo, but rather for a distinct copy of the template at Template:Foo/sandbox. Each of these two templates has its own "styles.css".
  2. The second copy of "styles.css" is a sandbox copy of the live version of "styles.css", not a copy of "styles.css" for use by the template at Template:Foo/sandbox. Both the live and sandbox templates should use the same "styles.css" unless testing changes to the stylesheet, with the sandbox of "styles.css" at styles.css/sandbox being used to test changes to "styles.css" rather than direct changes to the template.
If you follow the first interpretation of the purpose of the second copy of "styles.css", then logically following the first convention, that every sandbox page is located at the title of the page followed by /sandbox, agrees with using Template:Foo/sandbox/styles.css for the "styles.css" used by the sandbox copy of the template, since the second copy isn't itself a sandbox, it's just the stylesheet for the sandbox.
If you follow the second interpretation, then logically following the first convention agrees instead with using Template:Foo/styles.css/sandbox.
I think we should adopt and enforce interpretation 2, since there's no reason for Template:Foo/sandbox to have its own separate "styles.css" unless you're testing changes to to "styles.css", and the sandbox copy is logically where you would use to observe these tests. The convention then, would be that the sandbox copy of a page always consistently ends with /sandbox, regardless of whether the page is a template, a stylesheet, a module, etc. and to use the live version you would simply omit /sandbox. (Edit: I now support adopting and enforcing the /sandbox/styles.css convention, for the technical reasons highlighted below.)
Regardless of what we decide, Wikipedia:TemplateStyles § Naming convention should be updated to clearly and explicit state what editors should do. – Scyrme (talk) 15:36, 18 April 2026 (UTC)
I've always followed the second convention, because my mental model is that everything that is experimental should go into the sandbox subarticle. — hike395 (talk) 15:43, 18 April 2026 (UTC)
That's fair, but it runs up against the issue of how to interpret which page is the "parent" of its "child" subpages. Is it Template:Foo or Template:Foo/styles.css? I don't think there's a "right" answer here, but to me the latter seems much more straightforward if you think about the case where a template has another template as a subpage (Template:Foo/Bar) instead of a stylesheet as a subpage. Simply appending /sandbox is what would automatically happen if you clicked the "create" link in the documentation box of a subtemplate, for example if you were to create a sandbox for {{GHS Reference/cs1}}, which is a subpage of {{GHS Reference}}. – Scyrme (talk) 16:23, 18 April 2026 (UTC)
Another thing to consider is if we want all stylesheets to always end with .css. If that's desirable, perhaps the convention should be that we use /sandbox for the template's sandbox, and /sandbox.css for the sandbox of "styles.css"? This could also make it clearer that the second copy of the stylesheet is for testing changes to the stylesheet. – Scyrme (talk) 15:47, 18 April 2026 (UTC)
There are currently 39 pages with styles.css/sandbox. Around 34 of them were created at sandbox/styles.css but moved by Gonnym. There are 97 with sandbox/styles.css. Sampling didn't find any which had been moved so without Gonnym it would be around 5 versus 131. I also support sandbox/styles.css. It's expected that CSS pages end in .css, also by MediaWiki. If it's created at styles.css/sandbox then an administrator is required to change the content type to Sanitized CSS like in . This is impractical and likely to confuse many editors. PrimeHunter (talk) 16:19, 18 April 2026 (UTC)
Could adopting the use of /sandbox.css for stylesheet sandboxes work (as I suggested earlier)? Or would that also cause problems? – Scyrme (talk) 16:29, 18 April 2026 (UTC)
/sandbox.css would be created as Sanitized CSS and avoid the mentioned issue but I still prefer sandbox/styles.css. Template:Foo/styles.css/sandbox.css looks odd to me and editors are used to Template:Foo/sandbox/styles.css. PrimeHunter (talk) 16:47, 18 April 2026 (UTC)
To clarify, I was suggesting just using Template:Foo/sandbox.css not Template:Foo/styles.css/sandbox.css. ie. We'd be changing the guideline away from always using "styles.css", so that sandbox versions of the stylesheet are instead called "sandbox.css", and only live stylesheets are called "styles.css". Is there a technical reason why the stylesheet must be at a directory which includes "styles.css"? Or has doing so just been a convention? – Scyrme (talk) 17:02, 18 April 2026 (UTC)
TemplateStyles pages should normally be created at a ".css" title in the Template or Module namespace, to avoid having to have an administrator have to fix the content model. Even though WMF has recently changed things to allow people to create a page with a non-default content model using Special:ChangeContentModel, it's still likely that editors would create the page first, then realize it was wrong, and then have to have an admin fix it. Anomie⚔ 17:23, 18 April 2026 (UTC)
but moved by Gonnym Sadly, this does not surprise me. Anomie⚔ 17:23, 18 April 2026 (UTC)
Module namespace also has styles.css pages. When module namespace is included, first search gains 4: 39 → 43, second search gains 33: 97 → 130. —⁠andrybak (talk) 18:48, 18 April 2026 (UTC)
Looking at these examples I noticed another reason for consistently using /sandbox/styles.css, namely that {{Uses TemplateStyles}} expects and only detects the existence of a sandbox stylesheet if it's located at /sandbox/styles.css, but not if it's located at /styles.css/sandbox. If the stylesheet is located at the latter, no "(sandbox)" link is displayed.
We should probably move all the existing examples using /styles.css/sandbox to fix navigation. – Scyrme (talk) 19:31, 18 April 2026 (UTC)
Just for reference regarding {{Uses TemplateStyles}} expects and only detects the existence of a sandbox stylesheet if it's located at /sandbox/styles.css, but not if it's located at /styles.css/sandbox – this iteration of the logic in the underlying module was implemented in Special:Diff/861001237 per discussion at Wikipedia talk:TemplateStyles/Archive 1#Sandbox naming convention. —⁠andrybak (talk) 19:41, 18 April 2026 (UTC)
@Andrybak: Thank you for digging that out! I knew that it had been discussed before, I didn't think to go back almost eight years. RexxS (talk · contribs) raised some good points there. --Redrose64 🌹 (talk) 21:04, 18 April 2026 (UTC)
Template:Foo/sandbox/styles.css makes most sense to me. It's virtually certain that any real sandbox testing of the styles is going to also require use of Template:Foo/sandbox, if only to change the <templatestyles /> to point to the sandbox version, and in relation to that Template:Foo/sandbox/styles.css is more logical. Template:Foo/styles.css/sandbox lacks the ".css" extension, which is likely to cause problems and only makes sense if you're somehow trying to test changes to the styles in isolation from any changes to the parent template. Template:Foo/styles.css/sandbox.css just seems strange, and Template:Foo/sandbox.css requires editors to make assumptions as to what exactly it's the sandbox of. Anomie⚔ 17:23, 18 April 2026 (UTC)
I'm with Anomie's last paragraph entirely. --Redrose64 🌹 (talk) 17:48, 18 April 2026 (UTC)
No assumption needs to be made regarding Template:Foo/sandbox.css, as any /sandbox.css page would always been the sandbox version of the matching /styles.css page. So Template:Foo/sandbox.css is the sandbox for Template:Foo/styles.css, Template:Foo/Bar/sandbox.css is the sandbox for Template:Foo/Bar/styles.css etc. – Scyrme (talk) 18:07, 18 April 2026 (UTC)
Thinking about it more, I suppose the problem with sandbox.css is that a ".css" page doesn't necessarily have to be a stylesheet so there's nothing about that convention that implies it pairs with a styles.css page.
I now support the /sandbox/styles.css convention. – Scyrme (talk) 18:53, 18 April 2026 (UTC)
as any /sandbox.css page would always been the sandbox version of the matching /styles.css page Yes, that's the assumption that has to be made. If some template, for whatever reason, isn't following the /styles.css convention, then what? Anomie⚔ 18:59, 18 April 2026 (UTC)
I agree with Anomie that to test changes to a stylesheet, you need an accompanying sandbox template to make use of it. In cases where you're only testing changes to the template, you don't have to create a styles.css subpage; the sandbox page can continue to refer to the production styles.css page. I think it's more intuitive to keep sandbox versions of all supporting files (which could include stylesheets, utility templates, other templates within the same family, and so forth) with the same names and relative positions to the production template, just shifted below the sandbox subpage. isaacl (talk) 18:51, 18 April 2026 (UTC)
Agree with Issacl about test versions of all supporting files should be in /sandbox. The guideline should state this. — hike395 (talk) 19:01, 18 April 2026 (UTC)
Honestly kind of puzzling to be having this discussion, as it was settled in 2018. Izno (talk) 19:52, 18 April 2026 (UTC)
It was started because of the moves mentioned above by PrimeHunter. In November 2025, I tried clarifying it with Gonnym, but I wasn't convincing enough. The moves continued with the edit summary That's a local consensus for a single template that breaks every single other thing on this site: Special:Diff/1348614100, Special:Diff/1348614300.
I'd like to get a wider and clearer consensus to choose one of the conventions and discourage alternatives. —⁠andrybak (talk) 20:34, 18 April 2026 (UTC)
Why would it be puzzling? Not everyone knows that discussion occurred, it's not prominently linked to anywhere, and the guidelines were not amended to clarify the convention after that discussion so that confusion would continue doesn't surprise me. – Scyrme (talk) 21:03, 18 April 2026 (UTC)
It's the kind of thing that a cursory review of a talk page and its very short archive might have uncovered. And not all rules need to be written; I would have expected the convention to be clear. Obviously not.... Izno (talk) 21:46, 18 April 2026 (UTC)

Proposal to reword guidelines

I propose we amend Wikipedia:TemplateStyles § Naming convention as follows:

Naming convention
  • Style pages must be clearly associated with their templates or modules and named accordingly (e.g. Template:Blockquote uses Template:Blockquote/styles.css).
  • The naming convention is to save the stylesheet for an associated page, template or module in a subpage of said page called /styles.css. This ensures the page automatically has the correct content model (sanitized-css) and can be easily identified as a style page.
  • Style pages should be associated with a specific template/module or group of templates/modules, and named accordingly. This allows style pages to be easily identified and edited. In general, this means that a style page should be a subpage of the related template. e.g. Template:myTemplate/styles.css or Template:myTemplate/styles-foo.css, but not Template:styles-foo.css nor Template:foo.css.
  • A sandbox for a template or module's style page should be associated with its sandbox page by appending /styles.css to the /sandbox page. e.g. Template:myTemplate/sandbox/styles.css, but not Template:myTemplate/styles.css/sandbox.

This would clarify the reasons for the conventions used and where the style page should be located. Thoughts? Feedback? – Scyrme (talk) 19:19, 18 April 2026 (UTC)

Sounds good to me, although it might be possible to just integrate the sandbox example into the third bullet. --Ahecht (TALK
PAGE
)
14:04, 21 April 2026 (UTC)
Might get a bit busy, as there are already examples in the third bullet. – Scyrme (talk) 14:21, 21 April 2026 (UTC)
Two suggestions:
  • I think we need another bullet that states "Other pages associated with a template should have sandbox version stored under /sandbox. For example, a configuration page /config should have a sandbox version stored in /sandbox/config.
  • I'm concerned that the third bullet is a form of instruction creep. I have never seen any editor attempt to create a free-floating css file. I think the third bullet is unneeded and could be removed.
— hike395 (talk) 03:45, 22 April 2026 (UTC)
More information Digression about "/sandbox/config" ...
Close
@Hike395: This is a proposal for amending the guidelines at Wikipedia:TemplateStyles, not for guidelines regarding sandboxes or subpages in general. It wouldn't be appropriate to add guidance about other unrelated subpages (eg. /config) here. Including this guidance somewhere else may be appropriate, but that should be a separate discussion.
Regarding bullet 3, it's already there and has been there since June 2018, not long after the guidance page was created. It may be that you've never seen a free-floating .css file because the guideline was established early on and people have been following it. That said, it is somewhat redundant with bullet 2. Perhaps trimming it would be warranted. How common is it for style pages to be titled styles-foo.css as opposed to just styles.css? I wonder if that example is needed. – Scyrme (talk) 11:23, 22 April 2026 (UTC)
Fair enough --- we shouldn't mix in guidelines for data, etc. into the guidelines at WP:TemplateStyles. We can also keep bullet 3. — hike395 (talk) 09:11, 23 April 2026 (UTC)

Here's a diff between the current version and Scyrme's proposal with minor punctuation tweaks:

−
* Style pages must be clearly associated with their templates and named accordingly (e.g. [[Template:Blockquote]] uses [[Template:Blockquote/styles.css]]).
+
* Style pages must be clearly associated with their templates or modules and named accordingly (e.g. [[Template:Blockquote]] uses [[Template:Blockquote/styles.css]]).
−
* The naming convention is to save the stylesheet for an associated page, template or module in a subpage of said page called {{mono|/styles.css}}.
+
* The naming convention is to save the stylesheet for an associated page, template or module in a subpage of said page called {{mono|/styles.css}}. This ensures the page automatically has the correct [[Wikipedia:Content model|content model]] ({{tt|sanitized-css}}) and can be easily identified as a style page.
−
* Style pages should be associated with a specific template or group of templates, and named accordingly. This allows style pages to be easily identified and edited. In general, this means that a style page should be a subpage of the related template, e.g.: {{mxt|Template:{{var|myTemplate}}/styles.css}} or {{mxt|Template:{{var|myTemplate}}/styles-{{var|foo}}.css}}, but not {{!mxt|Template:styles-{{var|foo}}.css}} nor {{!mxt|Template:{{var|foo}}.css}}.
+
* Style pages should be associated with a specific template/module or group of templates/modules, and named accordingly. This allows style pages to be easily identified and edited. In general, this means that a style page should be a subpage of the related template, e.g. {{mxt|Template:{{var|myTemplate}}/styles.css}} or {{mxt|Template:{{var|myTemplate}}/styles-{{var|foo}}.css}}, but not {{!mxt|Template:styles-{{var|foo}}.css}} nor {{!mxt|Template:{{var|foo}}.css}}.
−
+
* A sandbox for a template or module's style page should be associated with its sandbox page by appending {{mono|/styles.css}} to the {{mono|/sandbox}} page. e.g. {{mxt|Template:{{var|myTemplate}}/sandbox/styles.css}}, but not {{!mxt|Template:{{var|myTemplate}}/styles.css/sandbox}}.

Are there any other suggestions? —⁠andrybak (talk) 19:42, 11 June 2026 (UTC)

Implemented the proposal in Special:Diff/1362071249. —⁠andrybak (talk) 19:31, 1 July 2026 (UTC)

Styles of editnotices

An interesting case of this guideline causing UI glitches is usage of TemplateStyles in subpages of Template:Editnotices. Example: Template talk:Editnotices/Page/Wikipedia:Teahouse#Template-protected edit request on 22 July 2026. The issue was resolved by moving the styles.css page to another related location. —⁠andrybak (talk) 00:27, 27 July 2026 (UTC)

If an editnotice is complex enough to need TemplateStyles, perhaps it should be a template of its own anyway. Anomie⚔ 23:05, 27 July 2026 (UTC)
Do you mean that the <templatestyles> tag shouldn't be put onto subpages of Template:Editnotices and instead there should an indirection through a template or page that's "outside" of these subpages? E.g. in case of Template:Editnotices/Page/Wikipedia:Teahouse, move its existing wikitext into Wikipedia:Teahouse/editnotice and leave only the transclusion {{Wikipedia:Teahouse/editnotice}} behind? —⁠andrybak (talk) 00:04, 28 July 2026 (UTC)
Yes. Anomie⚔ 00:47, 28 July 2026 (UTC)

Redlinked terrorism categories

The latest run of Special:WantedCategories features several redlinked "Terrorism in the [Decade]" categories that were recently deleted at WP:CFD, but remain populated because the categories are being artificially autogenerated and transcluded by {{Terrorist incidents in YYYY category header}}. However, there are several other decade categories for the 1910s, 2000s, 2010s and 2020s that have not been deleted, so I can't just yank that category-generation code out of the template since that would also depopulate the undeleted categories — but every time I've ever tried to #ifexist category code in a template by myself without soliciting outside help from template experts, I've broken other things in the process.

So could somebody who's more knowledgeable than I am about template coding quickly slap an #ifexist on the "Terrorism in the [Decade]" code so that the redlinked categories go away while the bluelinked ones don't? Thanks. Bearcat (talk) 15:13, 22 April 2026 (UTC)

The CFD was Wikipedia:Categories for discussion/Log/2026 April 5#Terrorism in the 1990s and it should not have been a some-but-not-all nom. Was Fayenatic london (talk · contribs) made aware that these cats are emitted by a template? --Redrose64 🌹 (talk) 12:45, 23 April 2026 (UTC)
I was aware. Pppery seems to have fixed the template now. We could simplify it using {{Category if exists}}.
There is a full series of "Terrorism incidents in the YYY0s" categories, so there was no need for "Terrorist incidents in YYYY" to populate "Terrorism in the YYY0s" for any date. – Fayenatic London 18:00, 23 April 2026 (UTC)

 You are invited to join the discussion at Wikipedia talk:AutoWikiBrowser § Usage of JWB/AWB for reducing phonetics links with templates, which is within the scope of this WikiProject. This regards usage of the {{lcons}} and {{lvow}} templates. ~ oklopfer (💬) 17:25, 10 June 2026 (UTC)

Seeking feedback on proposed navigation template

I have drafted a navigation template that would organize US Army infantry regiments by engagement. I believe this would be a helpful guide for readers to find related articles.

I'm new to template construction, so wanted to get some feedback on 1) the need/efficacy of the template and 2) the format of the template. Bravelake (talk) 19:53, 3 July 2026 (UTC)

Bravelake, for questions regarding content of the templates related to military, I recommend asking at Wikipedia talk:WikiProject Military history instead. —⁠andrybak (talk) 23:43, 3 July 2026 (UTC)
Thank you for the recommendation; I've listed it there as well. Bravelake (talk) 23:56, 3 July 2026 (UTC)

TFD for TFD templates

The TFD templates have been nominated for merging, see Wikipedia:Templates for discussion/Log/2026 July 3 § Template:Tfm notice for the discussion. Primefac (talk) 05:33, 4 July 2026 (UTC)

Mobile templatesNavboxes

Is there an existing resolution to hide templates on the mobile layout, or perhaps a general prohibition of the development of any MediaWiki feature that could possibly result in the display of a template on mobile devices? TPI81AF (talk) 00:48, 24 July 2026 (UTC)

Template:If mobile exists, but it should be used judiciously and sparingly. As a general rule, it is recommended to avoid using this template. Could you please be more specific with what problem you are trying to solve? —⁠andrybak (talk) 01:34, 24 July 2026 (UTC)
By template I meant a navigational template created using navbox. I forgot that they were called navboxes since the title of each page begins with Template: and the two terms became synonymous in my mind. TPI81AF (talk) 05:55, 24 July 2026 (UTC)
Or rather, the term "template" entirely supplanted the term "navbox". TPI81AF (talk) 05:57, 24 July 2026 (UTC)
TPI81AF If you're currently on mobile, and you can see your username at the start of this post, that means that templates work on mobile. --Redrose64 🌹 (talk) 20:07, 24 July 2026 (UTC)
Navboxes are indeed prevented from display due to two reasons: They look bad, and they add a lot to a mobile page load for a use case which mostly basically doesn't need them.
I've had some discussion with a WMF engineer about the second problem recently so there might be a future for them, but it is far away. cc User:Jdlrobson User:Jon (WMF) (yet another report :D). Izno (talk) 07:26, 24 July 2026 (UTC)
You can follow phab:T124168 for other discussion. Izno (talk) 07:47, 24 July 2026 (UTC)

Bold Navigational Template Redirects

Discussion moved to a better location. Primefac (talk) 23:09, 4 August 2026 (UTC)

Proposal for templates using DISPLAYTITLE

For templates changing the pages title with {{DISPLAYTITLE}} (e.g. {{lowercase title}}, {{italic title}}), I propose that the namespace colon use <span class="mw-page-title-separator">:</span> (a class used by MediaWiki by default). This is would bring support for DiscussionTools's additional space after the namespace on talk pages, consistent with regular page titles. It also allows for other custom css styling of the colon (for an example, see my global.css). While this change would only affect limited circumstances, like Talk:eBay or Wikipedia:Wikipedia Signpost, I think this would be a fairly positive change.

For an example implementation, see {{lowercase title/sandbox}}. Axolitl (talk | contribs) 00:49, 7 August 2026 (UTC)

Note that it could also be helpful to add mw-page-title-namespace and mw-page-title-main for further customization. For example:
<span class="mw-page-title-namespace">Wikipedia</span><span class="mw-page-title-separator">:</span><span class="mw-page-title-main">Example</span>
Axolitl (talk | contribs) 04:09, 7 August 2026 (UTC)
I understand that this change is incomplete, and for now the {{lowercase title}} may have led to more DISPLAYTITLE conflicts in Category:Pages with DISPLAYTITLE conflicts. Many are due to the untagged DISPLAYTITLE set by {{R from domain name}}. — Peterwhy (talk) 19:57, 7 August 2026 (UTC)
Are you sure this is related to my change to {{lowercase title}}? As far as I can tell, {{R from domain name}} does not use {{lowercase title}}, and rather uses its own implementation (I don't know why there is an error, but I don't think it's related to my change). The only other page in that category was a user page which uses both {{DISPLAYTITLE}} and {{lowercase title}}, a clear conflicting DISPLAYTITLE. Axolitl (talk | contribs) 20:37, 7 August 2026 (UTC)
Before the {{lowercase title}} change, in, say Xkcd.comXkcd.com, having both {{DISPLAYTITLE:xkcd.com}} (indirectly by {{R from domain name}}) and {{lowercase title}} together was not a conflict. Now, the new {{lowercase title}} gives a display title that is tagged and different. So I also understand that this change is not fully launched on all DISPLAYTITLE templates (like {{R from domain name}}) yet, and until then there will be more conflicts. — Peterwhy (talk) 20:53, 7 August 2026 (UTC)
I see what you mean. However, I would think that {{lowercase title}} simply shouldn't need to be used with {{R from domain name}} since it is redundant anyway. I think the best way to resolve this would just be to remove the {{lowercase title}} templates from the redirects already using the Rcat, then adding the functionality to the Rcat later. Axolitl (talk | contribs) 21:38, 7 August 2026 (UTC)
I have reverted. The change you made was both premature and separately undesirable. Premature clearly by the above,
Undesirable: We should not hack around upstream, and we should not also worry about inconsistencies. (That we even apply this template outside the mainspace is dumb, but this is not the point of today.)
You should file a task in Phab if you think it would be valuable to handle cases with a display title. Izno (talk) 21:09, 7 August 2026 (UTC)

"Template:Cleanup-quality" listed at Redirects for discussion

The redirect Template:Cleanup-quality has been listed at redirects for discussion to determine whether its use and function meets the redirect guidelines. Readers of this page are welcome to comment on this redirect at Wikipedia:Redirects for discussion/Log/2026 August 21 § Template:Cleanup-quality until a consensus is reached. LazyLune (talk • edits) 06:34, 21 August 2026 (UTC)

Related Articles

Timelines

Top Qs

Fact Checks