Template talk:Shortcut
Add topic
| To help centralize discussions and keep related topics together, Template talk:Policy shortcut redirects here. |
| Template:Shortcut is indefinitely protected from editing as it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
Text has been copied to or from this page; see the list below. The source pages now serve to provide attribution for the content in the destination pages and must not be deleted as long as the copies exist. For attribution and to access older versions of the copied text, please see the history links below.
|
| On 13 February 2025, it was proposed that this page be moved to Template:Linkbox. The result of the discussion was not moved. |
Question about anchors
[edit]It says that it automatically adds the shortcut as an anchor (For example: "WP:UNCIVIL").
But does it add an anchor without the """"WP:""""?
For example, it would be nice if it added "UNCIVIL" instead of "WP:UNCIVIL" - or add both as anchors, if that is preferred.
I ask, because of pages like WP:OC, where each section has an anchor template and a shortcut template. - jc37 08:22, 22 January 2025 (UTC)
- Yes, for example all of these should land at the same spot:
- "WP:" is a namespace alias and can be used in place of "Wikipedia:" for any page. — xaosflux Talk 10:25, 22 January 2025 (UTC)
- So if I remove the anchor template from WP:OC, and leave only the shortcut template; and then add WP:OC#OCYEAR to some other page, I will still land at the correct section? - jc37 10:51, 22 January 2025 (UTC)
- Oh shoot, sorry I only anecdotally test this quickly, didn't realize both were there. So no, {{shortcut}} is not producing a named section for the anchor without the "WP". That could potentially be built in to the module. For that specific page, as there are many anchors in each section removing just one of the anchor keywords doesn't seem very useful though (and even if a shortcut is removed later, keeping the anchor could still be useful). — xaosflux Talk 11:05, 22 January 2025 (UTC)
- Oh ok.
- And true about OC, but I'm seeing this over a lot of policy pages. So I think it would be nice to add that in.
- I don't know how the module is coded, but I think it's the difference between {{PAGENAME}} and {{FULLPAGENAME}} - jc37 11:20, 22 January 2025 (UTC)
- I agree a second anchor should be created for each shortcut. I was confused as to why it wasn't working after reading the /doc. FaviFake (talk) 15:32, 18 November 2025 (UTC)
- Oh shoot, sorry I only anecdotally test this quickly, didn't realize both were there. So no, {{shortcut}} is not producing a named section for the anchor without the "WP". That could potentially be built in to the module. For that specific page, as there are many anchors in each section removing just one of the anchor keywords doesn't seem very useful though (and even if a shortcut is removed later, keeping the anchor could still be useful). — xaosflux Talk 11:05, 22 January 2025 (UTC)
- So if I remove the anchor template from WP:OC, and leave only the shortcut template; and then add WP:OC#OCYEAR to some other page, I will still land at the correct section? - jc37 10:51, 22 January 2025 (UTC)
ER
[edit]| It is requested that an edit be made to the template-protected template at Template:Shortcut. (edit · history · last · links · sandbox · edit sandbox · sandbox history · sandbox last edit · sandbox diff · test cases · transclusion count · protection log) This template must be followed by a complete and specific description of the request, so that an editor unfamiliar with the subject matter could complete the requested edit immediately.
Edit requests to template-protected pages should only be used for edits that are either uncontroversial or supported by consensus. If the proposed edit might be controversial, discuss it on the protected page's talk page before using this template. Consider making changes first to the template's sandbox and test them thoroughly here before submitting an edit request. To request that a page be protected or unprotected, make a protection request. When the request has been completed or denied, please add the |
The sandbox version should hopefully make this work:
| Line 84: | Line 84: |
| :tag('div') | :tag('div') |
| :addClass('module-shortcutanchordiv') | :addClass('module-shortcutanchordiv') |
| local seenAnchors = {} | |
| for i, shortcut in ipairs(shortcuts) do | for i, shortcut in ipairs(shortcuts) do |
| local anchor = mw.uri.anchorEncode(shortcut) | local anchor = mw.uri.anchorEncode(shortcut) |
| if not seenAnchors[anchor] then | |
| anchorDiv:tag('span'):attr('id', anchor) | anchorDiv:tag('span'):attr('id', anchor) |
| seenAnchors[anchor] = true | |
| end | |
| -- Also anchor the shortcut's page name without its namespace prefix, so that e.g. [[#WP:OCYEAR]] and [[#OCYEAR]] | |
| -- land in the same place even if only the shortcut template is present. | |
| local titleObj = mw.title.new(shortcut) | |
| if titleObj and titleObj.text ~= '' and titleObj.text ~= shortcut then | |
| local altAnchor = mw.uri.anchorEncode(titleObj.text) | |
| if not seenAnchors[altAnchor] then | |
| anchorDiv:tag('span'):attr('id', altAnchor) | |
| seenAnchors[altAnchor] = true | |
| end | |
| end | |
| end | end |
Edit request 5 June 2025
[edit]This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
Description of suggested change:
Diff:
| line 52: | line 52: |
| if options.target and yesno(options.target) then | if options.target and yesno(options.target) then |
| listItems[i] = templateMode | listItems[i] = templateMode |
| and string.format("{{%s[[%s|%s]]}}", prefix, templatePath, shortcut) | and string.format("TM:{{%s[[%s|%s]]}}", prefix, templatePath, shortcut) |
| or string.format("[[%s]]", shortcut) | or string.format("[[%s]]", shortcut) |
| else | else |
| line 60: | line 60: |
| } | } |
| if templateMode then | if templateMode then |
| listItems[i] = string.format("{{%s%s}}", prefix, listItems[i]) | listItems[i] = string.format("TM:{{%s%s}}", prefix, listItems[i]) |
| end | end |
| end | end |
Whatback11 (talk) 17:23, 5 June 2025 (UTC)
- Please provide a "complete and specific description of the request". GoldRomean (talk) 19:01, 5 June 2025 (UTC)
- I think we should make it clear that the shortcut for "template:" is "tm:". Whatback11 (talk) 14:15, 11 June 2025 (UTC)
- It would be useful if you could identify a page where this change would make a difference, and state what that difference would be. Johnuniq (talk) 08:38, 12 June 2025 (UTC)
- The viewer can see that the shortcut for template: is tm: Whatback11 (talk) 06:52, 5 July 2025 (UTC)
- I disagree with this change. I have been here for 12 years and have never seen "TM" used as a short version of the template namespace. It is definitely not needed in this template, especially outside the braces, where it makes no sense. – Jonesey95 (talk) 13:49, 10 July 2025 (UTC)
- "TM:" is a shortcut for "template:". Try typing "tm:tm" in the search field and pressing Enter. Whatback11 (talk) 10:54, 8 August 2025 (UTC)
- So if I read this correctly, if I were to make a link to a template, such as "TM:Color", that it would work like the other namespace "shortcuts" (aliases)? Here it is:
- Well, I'll be darned. To be honest, editor Whatback11, I don't think that the "TM:" is needed in the shortcut box because the double braces are already there, and they are only used on WP to indicate templates. The TM alias isn't as well-known as WP and WT, but it's usage is for template links, not for template transclusions or substitutions. P.I. Ellsworth , ed. – welcome! – 13:12, 23 November 2025 (UTC)
- Then, using Template:A as an example, instead of putting everything on one line as TM:{{A}}, how about adding a small gray note below {{A}} saying, "You can also link to it as TM:A"? Whatback11 (talk) 14:46, 23 November 2025 (UTC)
- If a template-link shortcut is wanted, then a simple
{{sh|TM:Shortcut}}is already available for usage, as shown to the right. Sorry, but I don't think that adding a note below the template shortcut(s) would help editors. The notes would really get hairy when there are two or more template shortcuts in the box. P.I. Ellsworth , ed. – welcome! – 16:07, 23 November 2025 (UTC)- Do you have any other suggestions for making viewers aware of the “TM:” shortcut? If not, I agree to leave things as they are without making this edit. Whatback11 (talk) 08:53, 26 November 2025 (UTC)
- Yes, gentle reminders on appropriate talk pages always help. Frankly, I hardly ever used the old alias for template links, which was just a simple and ambiguous "T:". I didn't know about "TM:" until this edit request and discussion made me look back at the Aliases section of the Namespace info page. We TEs are supposed to be aware of all the nooks and crannys when it comes to templates; however, sometimes an important change might slip by us for awhile. I want to thank you very much, editor Whatback11! Even though this edit request didn't happen, at the very least you have informed me and other TEs who didn't know about the change in the alias of the template namespace. You've already done a lot to spread the word about the usage of "TM:"! P.I. Ellsworth , ed. – welcome! – 12:07, 26 November 2025 (UTC)
- Then, I would like to cancel this edit request. Whatback11 (talk) 09:54, 29 November 2025 (UTC)
- Yes, gentle reminders on appropriate talk pages always help. Frankly, I hardly ever used the old alias for template links, which was just a simple and ambiguous "T:". I didn't know about "TM:" until this edit request and discussion made me look back at the Aliases section of the Namespace info page. We TEs are supposed to be aware of all the nooks and crannys when it comes to templates; however, sometimes an important change might slip by us for awhile. I want to thank you very much, editor Whatback11! Even though this edit request didn't happen, at the very least you have informed me and other TEs who didn't know about the change in the alias of the template namespace. You've already done a lot to spread the word about the usage of "TM:"! P.I. Ellsworth , ed. – welcome! – 12:07, 26 November 2025 (UTC)
- Do you have any other suggestions for making viewers aware of the “TM:” shortcut? If not, I agree to leave things as they are without making this edit. Whatback11 (talk) 08:53, 26 November 2025 (UTC)
- Then, using Template:A as an example, instead of putting everything on one line as TM:{{A}}, how about adding a small gray note below {{A}} saying, "You can also link to it as TM:A"? Whatback11 (talk) 14:46, 23 November 2025 (UTC)
- "TM:" is a shortcut for "template:". Try typing "tm:tm" in the search field and pressing Enter. Whatback11 (talk) 10:54, 8 August 2025 (UTC)
- I disagree with this change. I have been here for 12 years and have never seen "TM" used as a short version of the template namespace. It is definitely not needed in this template, especially outside the braces, where it makes no sense. – Jonesey95 (talk) 13:49, 10 July 2025 (UTC)
- It would be useful if you could identify a page where this change would make a difference, and state what that difference would be. Johnuniq (talk) 08:38, 12 June 2025 (UTC)
- I think we should make it clear that the shortcut for "template:" is "tm:". Whatback11 (talk) 14:15, 11 June 2025 (UTC)
@Whatback11:
Not done for now: please establish a consensus for this alteration before using the {{Edit template-protected}} template. Est. 2021 (talk · contribs) 16:24, 10 July 2025 (UTC)
- What can I do to reach a consensus? Whatback11 (talk) 12:17, 23 November 2025 (UTC)
- @Whatback11: See Wikipedia:Consensus. In brief: discuss it with others, see what develops. --Redrose64 🌹 (talk) 20:55, 24 November 2025 (UTC)
A little help
[edit]Would somebody mind helping me fix the short cut at WP:CITE#Citations in explanatory footnotes? I changed the title of the header, and that seems to have broken it. The name of the shortcut is WP:EXPLNOTESECT.---- CharlesTGillingham (talk) 16:03, 1 July 2026 (UTC)
- @CharlesTGillingham: Done, like this. --Redrose64 🌹 (talk) 11:45, 2 July 2026 (UTC)
- Thanks. I learned how shortcuts work today! --- CharlesTGillingham (talk) 13:57, 2 July 2026 (UTC)
ER
[edit]| It is requested that an edit be made to the template-protected template at Template:Shortcut. (edit · history · last · links · sandbox · edit sandbox · sandbox history · sandbox last edit · sandbox diff · test cases · transclusion count · protection log) This template must be followed by a complete and specific description of the request, so that an editor unfamiliar with the subject matter could complete the requested edit immediately.
Edit requests to template-protected pages should only be used for edits that are either uncontroversial or supported by consensus. If the proposed edit might be controversial, discuss it on the protected page's talk page before using this template. Consider making changes first to the template's sandbox and test them thoroughly here before submitting an edit request. To request that a page be protected or unprotected, make a protection request. When the request has been completed or denied, please add the |
This can't possibly be controversial so I'll open an edit request. The module should wrap each shortcut in a nowrap span for cases like Special:PermanentLink/1366587294, where 1 short shortcut uses 2 lines instead of 1, see sandbox.
This is an explanatory essay about the Wikipedia:Content forks and Wikipedia:Talk page guidelines. This page provides additional information about concepts in the page(s) it supplements. This page is not one of Wikipedia's policies or guidelines, as it has not been thoroughly vetted by the community. |
| Line 63: | Line 63: |
| end | end |
| end | end |
| -- Wrap each shortcut in a nowrap span for shortcuts like [[WP:CFORK/I]] in [[Special:PermanentLink/1366587294]] | |
| listItems[i] = string.format('<span class="nowrap">%s</span>', listItems[i]) | |
| end | end |
| table.insert(listItems, options.msg) | table.insert(listItems, options.msg) |