Help talk:Magic words

From Wikipedia, the free encyclopedia
Jump to: navigation, search
the Wikipedia Help Project  
WikiProject icon This page is within the scope of the Wikipedia Help Project, a collaborative effort to improve Wikipedia's help documentation for readers and contributors. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks. To browse help related resources see the help menu or help directory. Or ask for help on your talk page and a volunteer will visit you there.
 ???  This page does not require a rating on the project's quality scale.
 ???  This page has not yet received a rating on the project's importance scale.

A quirk[edit]

Hi all,

  • Over at Wikipedia:Copyright problems there's a section which contains "Wikipedia's current date is {{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}}...". However, those magic words don't seem to take effect; I just see it rendered as "Wikipedia's current date is CURRENTMONTHNAME CURRENTDAY, CURRENTYEAR. I tried editing the section; after a punctuation tweak it seemd to work in Preview, but on saving the change they're still redlinks. I know that these magic words are used elsewhere successfully (a lot of portals have boxes of "On 05 October..." type content). What's going on? Am I missing something obvious? There are lots of other templates on the affected page so maybe the parser has indigestion? If so, perhaps we should document that weakness more clearly as I couldn't find anything.
  • On a related point: Should this help page explain the distinction between magic words and templates, even though both can be invoked with double braces? For instance, if there was a template with the same name as a magic word, presumably it couldn't be invoked in the usual way..? (Whilst trying to figure out what was happening on Wikipedia:Copyright problems I found that there were templates like {{CURRENTMONTHNAME}} which got deleted years ago - they all seem to have been attempts at template vandalism).

Any suggestions? bobrayner (talk) 22:38, 5 October 2012 (UTC)

Richardguk (talk) 23:23, 5 October 2012 (UTC)
Groovy; thanks. bobrayner (talk) 01:32, 6 October 2012 (UTC)

Arithmetic operators with magic words[edit]

Sorry if this is a stupid question, but I want to be able to use something other than UTC in my sig file, yet I don't want it necessarily to be the time of my computer (I think there's a COMPUTERTIME magic word -- I don't want that). How do I use a math. operator with CURRENTTIME?

Something like the following is what I want to be able to do, but where adding 1 actually works. :)

{{subst:CURRENTTIME+1}} (Berlin Time)


BWP1234 (talk) 11:57, 25 November 2012 (UTC)

Using the help page here, I constructed {{subst:#time:H:i, j F Y|now +1 hour}} which displays as "13:12, 25 November 2012". BUT I'm not convinced this is a good idea, as it will make it hard for other editors to compare your timestamps with those of other editors. -- John of Reading (talk) 12:12, 25 November 2012 (UTC)

Thanks for the quick reply! I'll reflect on the effect on other users before implementing this. (Another ?: Why on earth doesn't Wikimedia default to the ISO date format?= BWP1234 (talk) 12:39, 25 November 2012 (UTC)

For the same reason that it's discouraged at WP:DATESNO - it's not the natural way of writing dates. --Redrose64 (talk) 14:16, 25 November 2012 (UTC)
Thanks for the answer, though I (weakly) disagree that it's not the "natural" way of writing dates, but, more importantly, strongly disagree that whatever's natural should be determinate. --User:BWP1234 (talk) 2012-11-25, 14:46 (New York Time)
There are a number of scripts and bots that expect that dates and times will be written in a particular format. If you try to deviate from that format, stuff like this happens. --Redrose64 (talk) 23:44, 25 November 2012 (UTC)
Let's hope someone soon realizes that badly written bots need to be scrapped, or rewritten! --User:BWP1234 (talk) 2012-11-26, 02:37 (New York Time)
Bots are coded to implement an agreed standard. You are welcome to start a discussion about changing the standard to allow for varying time zones, but I, for one, would favour consistency. -- John of Reading (talk) 08:19, 26 November 2012 (UTC)
Myself, I favor diversity, and everything that enables diversity to flower! --User:BWP1234 (talk) 2012-11-26, 07:44 (New York Time)
I sympathise with your point that the ISO format would be more logical, but you've even departed from that by using a local timezone instead of UTC.
More importantly, the adopted signature format has been chosen because it is the single most commonly used and recognised unambiguous international English-language format. So it is not an arbitrary choice. And dozens of bots rely on this standard being followed. In particular, Wikipedia:Signatures indicates that non-standard timestamps can confuse bots which automatically archive sections according the date of the most recent comment.
You are free to propose a new format, but until community consensus adopts your proposal, the onus is on you to respect the agreed guidelines – or create a more diverse wiki on your own website and edit there instead!
Richardguk (talk) 13:27, 26 November 2012 (UTC)
Here is an example of an ISO format date being wrongly interpreted. There are two possibilities: (i) the person who added the ref had assumed that the format should be CCYY-DD-MM and has applied the correct fix for that; (ii) the person who added the ref had used the format CCYY-MM-DD, but has assumed that it was formatted CCYY-DD-MM and applied the incorrect "fix". In fact it was the latter. This sort of issue will always arise unless we insist upon months being written out as words. --Redrose64 (talk) 13:53, 27 November 2012 (UTC)
Redrose64: I wouldn't mind writing out the month, but the year should come first: biggest units to smallest units (seconds).
As for this: "The adopted signature format has been chosen because it is the single most commonly used and recognized unambiguous international English-language format."
I'm not sure I agree, though I may misunderstand. Though I probably disagree no matter what you mean. Is "international English" a compound noun, modified by the preceding adjectives? If so, I disagree with the application of the adjectives, but mostly with the very idea that there is something that should be regarded as "international English" (though there probably should be some kind of international English -- it would certainly help nonnative speakers!) 2) If "international" is one of the adjectives, then ISO is probably more widely recognized -- or recognizable --(though perhaps not yet most widely used).
If a condition of my participation here is that I have to conform to a standard I disagree with, I may bow out. Anyway, thanks for the explanations. --User:BWP1234 (talk) 2012-11-27, 12:56 (New York Time)

Help with magic words in a template[edit]

Hello, i'm a member of WP:MMA a wikiproject for Mixed Martial Arts. We have been experiencing some troubles with pages being marked for deletion in part because they lack good sources. I thought it might help to build a template that could be dropped in a talk page that would help people find sources. the problem is that the pages in question have spaces in their names, example being UFC 49, the space breaks the external link so the template ends up useless. the magic word i'm using is {{BASEPAGENAME}}, i've tried {{BASEPAGENAMEE}} which replaces the space with an underscore, that makes the link work, but breaks the google search, so again it doen't actually work for what i want it to. When i use the template I've created in a page with no spaces it looks and works great. Anyway, the template i made is {{MMA find sources}}, if you click on that you will see it broken, or you can check out my sandbox (the same template, but my sandbox title doesn't have spaces) to see how i hoped it would look and work. Any help is much appreciated! Kevlar (talk) 09:19, 5 December 2012 (UTC)

The template {{Find sources}} uses "urlencode" to get round this, so I suggest you adapt the coding from there. -- John of Reading (talk) 11:20, 5 December 2012 (UTC)
(edit conflict) Probably redundant now that John has pointed you to {{Find sources}}, but in case it's of further help:
Wrap the page name in {{urlencode:...}} to convert spaces to pluses (which Google will convert back to spaces). For example, "{{urlencode:{{BASEPAGENAME}}}}" produces "Magic+words".
Note that {{BASEPAGENAME}} risks removing any part of the article name after a slash (for example, "A/B testing" would produce "A"). On the other hand, {{PAGENAME}} risks including extraneous subpages if it is transcluded on talk subpages (such as archive pages). If you will only ever use the template on the main article talk pages, "{{urlencode:{{PAGENAME}}}}" would be most appropriate.
Richardguk (talk) 11:27, 5 December 2012 (UTC)
thanks very much! you guys both rock! Kevlar (talk) 21:05, 5 December 2012 (UTC)

Scope of basic search[edit]

I wonder where it is possible to learn where the scope of basic search, or Advanced search by selected namespaces, is extended beyond the page as rendered by my webbrowser.

Specifically regarding magic words, by accident I learned that basic search for 'FORCETOC' (or 'FORCETOC_' and others) hits 543 articles. Initially I supposed that those are all of the English wikipedia articles that use the magic word, and visiting some may be instructive.

Soon I lost that faith, finding 2 hits for BASEPAGENAME and none for NEWEDITSECTION.

Similarly --for two that are not magic words but likely to be confused, if i understand correctly-- 216 hits for DEFAULTSORT (in article space, not the redirect to help space) and 1 hit for TOCLIMIT.

Now I wonder whether these searches hit mistaken appearances in article code, which are relatively few in number and may have diagnostic value because something needs to be fixed --instructive value as illustrations only in the negative, so to speak.

--P64 (talk) 03:36, 14 February 2013 (UTC)

Ignore parts of a string for ifeq/switch-conditions[edit]

I have a number of strings that are entered in templates that contain 3 letters followed by 3 digits, for example "ISS064" or "STS123". Is there a way to make a compare or ifeq comparison to find out whether the beginning of the string is "ISS" or "STS" without making a comparison between the string and all possible numbers behind them?

Example how it's done now:

{{#ifeq: {{#switch: {{{mission}}} | ISS001 = ISS | ISS002 = ISS | ISS003 = ISS | ... | ISS049 = ISS | ISS050 = ISS | Other }}| ISS | 1 | 2 }}

That, however, is getting slightly annoying for several hundred cases. Any help would be greatly appreciated. Thanks. --Julian H. (talk) 16:42, 23 March 2013 (UTC)

You can pick out the first three characters using {{str left}}. Try something like...
{{#ifeq: {{str left|{{{mission}}}|3}} | ISS | 1 | 2 }}
-- John of Reading (talk) 16:58, 23 March 2013 (UTC)
Thank you very much, that is indeed much easier. --Julian H. (talk) 17:43, 23 March 2013 (UTC)


Could someone please add the necessary documentation for __DISAMBIG__ (mw:Extension:Disambiguator)? Thank you. -- Michael Bednarek (talk) 13:51, 11 July 2013 (UTC)

Yes check.svg Done, see here --Redrose64 (talk) 14:30, 11 July 2013 (UTC)


Is there some way to auto-generate text that is tomorrows date? Context: Wikipedia:Redirects for discussion/Today transcludes today's RfD discussions, but the page would be a million times better if it included a link to the previous day's discussions. Ego White Tray (talk) 03:07, 13 June 2014 (UTC)

@Ego White Tray: Yes, the #time magic word can do this. The documentation is at mw:Help:Extension:ParserFunctions#.23time.
*[[Wikipedia:Redirects for discussion/Log/{{CURRENTYEAR}} {{CURRENTMONTHNAME}} {{CURRENTDAY}}]]
*[[Wikipedia:Redirects for discussion/Log/{{#time:Y F j|now - 1 day}}]]
*[[Wikipedia:Redirects for discussion/Log/{{#time:Y F j|now + 1 day}}]]
-- John of Reading (talk) 05:21, 13 June 2014 (UTC)

Three "behavior switches" that aren't[edit]

Regarding the following three keywords:

  • {{DISPLAYTITLE:title}}
  • {{DEFAULTSORT:sortkey}}
  • {{noexternallanglinks}}

All three of these are presently included in the list of behavior switches, but they aren't behavior switches; the first two are variables, and the third is a parser function. It seems to me that they should be moved from the "Behavior switches" section to the "Variables" and "Parser functions" sections, respectively. — Jaydiem (talk) 00:18, 17 July 2014 (UTC)

The first two do not return a value: they are not variables. The third does not take a value, process it and return another value: it is not a parser function. All three change the behaviour of the page: they are behaviour switches. --Redrose64 (talk) 00:27, 17 July 2014 (UTC)
If you examine the linked references I provided above—or the "General information" section within the article itself—I believe you will find them to be incompatible with that interpretation. — Jaydiem (talk) 01:22, 17 July 2014 (UTC)
It's an inconsistency within the page. I have raised the matter at mw:Help talk:Magic words#Variables that affect behaviour. Please do not use bullets for indenting talk page posts: see WP:TPG#Layout (third bullet) and WP:TPO#fixformat. --Redrose64 (talk) 10:21, 17 July 2014 (UTC)
Thanks. When I noticed the discrepancy between how these three keywords are characterized here versus in the MediaWiki documentation, I thought I should point it out. I grant that all three affect page display, and thus behave differently from other variables and parser functions, but the MediaWiki categorization of keywords appears to key on their format and mechanism of action rather than on their effects. ~ Regarding indentation, over time I've developed the habit of including a bullet before the first paragraph of replies, and only colons before subsequent paragraphs of the same reply, as I find that this greatly improves readability. If it's good for threaded discussions in AfD, CfD, RfC, etc., then it's good elsewhere. But I'll defer to your request here. — Jaydiem (talk) 13:51, 17 July 2014 (UTC)


I'd like to have WP:PAGENAME for WP:Page name.

Please let me know why I should not do that. I will be happy to reason further if need be. Thanks. — CpiralCpiral 04:18, 7 August 2014 (UTC)

(i) because it's got incoming links, possibly some from edit summaries as well; (ii) because it's an established shortcut which has been around for over 6 12 years; (iii) because this is the wrong venue: repurposing of existing redirects (incl. shortcuts) is a WP:RFD matter. --Redrose64 (talk) 11:48, 7 August 2014 (UTC)
I know it's asking a lot, but I think it's constructive for newer editors, so I'll go to Redirects for Discussion. Thanks for the direction. — CpiralCpiral 23:01, 7 August 2014 (UTC)

Per Wikipedia:Rfd#The_guiding_principles_of_RfD

RfD is not the place to resolve most editorial disputes. If you think a redirect should be targeted at a different article, discuss it on the talk pages of the current target article and/or the proposed target article. However, for more difficult cases, this page can be a centralized discussion place for resolving tough debates about where redirects point.

I realize it is a difficult thing to ask established and productive editors to change what was a learned habit. I assume this is going to be difficult, so I posted there. However I just noticed it says "for resolving debates". If I could get more admins and editors like Redrose to champion WP:Page name by using that terminology and modifying more pages to use that terminology, I'd gladly give up a redirect. But it doesn't have to be a battle. It only has to be a civil debate with a week long window, and we all conclude what is rational and reasonable. Right? — CpiralCpiral 07:29, 8 August 2014 (UTC)

Basically, what I posted there:

  • WP:Page name has no redirect to its title.
  • wp:pagename is the obvious choice for it.
  • help:pagename already works for Help:Page name, the sister page of WP:Page name.
  • The Project version of Page name is an important page (in theory) for Project improvement because it provides a concise terminology currently lacking on many project pages. Its is mature and stable. — CpiralCpiral 07:29, 8 August 2014 (UTC)

To respond to your reasons for keeping it:

  • Project improvement implies "for the future" and "for new admins". What's more important, the changing of a 6 12 yr old habit of an established coder, or the sense of new admins who can type either help:pagename or wp:pagename to get to Help and Project sister pages?
  • help:pagename is almost 6.5 yrs old. It is has been pointing to the same place for all its life: to the top of the page Help:Page name.
  • Your current redirect for wp:pagename pointed to the top of the page Magic words for several years before it was used to redirect to Variables.
  • For some, like me, but not others, there is an important distinction between the Help and Project namespaces concerning content. Your use of Project:pagename says its in the Help namespace.
  • I will of course gladly modify all the incoming links necessary to point to wp:var instead of WP:Page name, if we re-reference wp:pagename, although I can't fix edit summaries, or get search results for talk page history. — CpiralCpiral 07:29, 8 August 2014 (UTC)

A fitting compromise was found:

  • WP:Pagename --> WP:Page name, and wp:pagename navigates there Yes check.svg Done
  • WP:PAGENAME --> WP:Magic words#Variables, and wp:PAGENAME goes there Yes check.svg DoneCpiralCpiral 20:34, 9 August 2014 (UTC)