Jump to content

Help talk:Magic words/Archive 001

From mediawiki.org

Invoking tag without anonymous parameter

Hi, It look that invoking an XML-like extention with the #tag syntax but wihtout anonymous parameter is wrong. I made a test on the OpenStreetMap wiki (see [1]) with the folowing code

{{#tag:slippymap|lat=47.2553|lon=6.0121|z=12|w=300|h=550|format=jpeg}}

and I got errors. But the following code (with an empty anonymous parameter)

{{#tag:slippymap||lat=47.2553|lon=6.0121|z=12|w=300|h=550|format=jpeg}}

seems good (see [2]).

If the bug is from mediawiki, maybe it should be interresting to warn the users. FrViPofm 17:13, 31 August 2009 (UTC)

Why do you consider it a bug?
{{#tag:tagname|content|parameter=value|more parameters}}</nowiki>
produces
<tagname parameter="value">content</tagname>
In your first example, you were sticking lat=47.2553 in as the content. Maybe it should be interesting to use it properly ^_^. Splarka 07:39, 1 September 2009 (UTC)
Because the syntax N=X is widely used for passing named parameters, it is strange to find it as anonymous parameter, and IMHO it is not consistent with the use of templates where we can find templateName|N1=X1|N2=X2|Anon1|Anon2...FrViPofm 08:38, 1 September 2009 (UTC)
Well, it isn't "anonymous", it is just that the first parameter after the name is aways the content for #tag. Your use case happens to require it to be blank. That isn't buggy. Splarka 07:04, 2 September 2009 (UTC)

{{PAGESINCATEGORY:Beer}}

If I am not mistaken, this tag is no longer Expensive because of the schema changes made in 1.14 or 1.15. (Rob Church?)
If someone who knows better than I do agrees with my analysis, can you please remove that tag from the entry on this page?
Cheers!
--204.138.115.3 20:52, 3 September 2009 (UTC)

Request regarding urlencode

The old version on urlencode replaced spaces with underscores, however, a relatively recent change means that it now replaces spaces with plus signs. There is at least one (and I assume several) applications in which it is still necessary to have the underscore: when converting a string for use at http://stats.grok.se, underscores are required instead of spaces.

Therefore, is it possible for someone to create a new magic word called urlencode2 (or something similar)? This could process the subject string through urlencode, then change any instances of "+" to "_". If this is not the right place to request something like this, please direct me elsewhere. Thanks! --Zach425 19:11, 9 September 2009 (UTC)

Old version? relatively recent change? It looks like urlencode was introduced in rev:14273, only moved from Parser.php to CoreParserFunctions.php in rev:15276 where it has remained unchanged to this day. Where did you observe this change, Wikia perhaps? Splarka 07:10, 10 September 2009 (UTC)
Followup: here is the Help page on meta just a few weeks after it was introduced: m:Help:Magic words#Namespaces and URLs. It shows {{urlencode: x y %@ }} producing +x+y+%25%40. Splarka 07:23, 10 September 2009 (UTC)
You're absolutely correct - it seems I was MUCH mistaken regarding the "recent change". I'm sure I read that urlencode previously used an underscore instead of a plus sign (and its usage on Wikipedia suggests that this was indeed the case), but now I can't seem to find the site where I read that.
Urlencode aside, would it be possible to add rawurlencode as a magic word? I've found some documentation on it that indicates it would work for the problem stated above, as stats.grok.se accepts either _ or %20 in place of a space. Unfortunately, my very limited knowledge about PHP, Java, & MediaWiki doesn't allow me to act on what I've seen. Thanks again. --Zach425 08:43, 10 September 2009 (UTC)
You can use the "escaped" version of the name-based magic words. For example: {{FULLPAGENAMEE}} produces "Help_talk:Magic_words/Archive_001", in a URL you can utilize it thusly: http://google.com/search?q=site%3Amediawiki.org+Help_talk%3AMagic_words%2FArchive_001 Splarka 13:26, 10 September 2009 (UTC)
THANK YOU, Splarka! This is just what I needed, but I unfortunately didn't understand FULLPAGENAMEE well enough to realize it! --Zach425 04:35, 11 September 2009 (UTC)

Using {{PAGESINCATEGORY}} in a nested parser function

Sorry if this is a known workaround. I was unable to find it easily if it does exist out there somewhere.

I was running into a bit of a snag using the following parser function to evaluate whether a category should show a category tree or not (strictly a stopgap measure) at the top of the page.:

{{#ifexpr:{{PAGESINCATEGORY:{{PAGENAME}}}}>100|{{#categorytree:{{PAGENAME}}|hideroot|showcount}}|}}

It seems that if there are more than 1000 pages in the category, {{PAGESINCATEGORY}} fails because a comma is inserted into the number and the expression cannot parse it as a numerical value. The workaround here is to use the {{#replace}} function:

{{#ifexpr:{{#replace:{{PAGESINCATEGORY:{{PAGENAME}}}}|,|}}>100|{{#categorytree:{{PAGENAME}}|hideroot|showcount}}|}}

RCWizard 23:12, 15 September 2009 (UTC)

You can just use {{formatnum:~|R}}. That will also work on wikis set to a content language that delimits with periods, for example. Splarka 07:04, 16 September 2009 (UTC)

Why not REVISIONTIME?

Why not {{{REVISIONTIME}}} ? --Dvdgmz 15:53, 8 October 2009 (UTC)

PAGENAME, titleparts and categories

I'm trying to create a template that:

  • Auto-categorizes the including page
  • Sorts on the page name, but with a leading sub-page element stripped (e.g. "A/B/C" becomes "B/C")

What I have so far is something like:

<noinclude>[[Category: {{{catname|General}}} | {{{catsort|{{#titleparts: {{subst:PAGENAME}} | 0 | 2 }} }}} ]]</noinclude>

This fails because of the inclusion/substitution order, but for the life of me, I can't get the right ordering of <noinclude>...</noinclude> and subst: that works for this. Can someone help me out, here and either point me to somewhere that #titleparts is used with PAGENAME in a template or show me an example that's otherwise known to work? Thanks. -Harmil 20:48, 12 October 2009 (UTC)

NUMBEROFACTIVEUSERS

Not much explanation on this - what is the definition of an active user? Based on number of edits / views? How recent? --Robinson Weijman 09:54, 10 November 2009 (UTC)

/includes/SiteStats.php
$activeUsers = $dbr->selectField( 'recentchanges', 'COUNT( DISTINCT rc_user_text )',
	array( 'rc_user != 0', 'rc_bot' => 0, "rc_log_type != 'newusers' OR rc_log_type IS NULL" ),
	__METHOD__ );
It scrapes the recent changes table, so this depends on your Manual:$wgRCMaxAge setting. Splarka 08:23, 11 November 2009 (UTC)
Thanks --Robinson Weijman 08:55, 22 January 2010 (UTC)

Comment about reverted edit

Happy-melon reverted this component

§§ and also see that page for information about substitution (subst:) of these parser functions. §§

What I was trying to indicate is that if one wants to substitute Magic words that one needs to follow the link to get instructions on how to undertake the task as they are not contained on the this page. Billinghurst 11:24, 3 December 2009 (UTC)

But that isn't where one should go to get those instructions; rather, one should look at Help:Substitution, which unfortunately hasn't yet been imported from meta. Happymelon 18:17, 3 December 2009 (UTC)
That may be right, but it isn't being helpful. I find it interesting (read: hard to understand) that there is a level of purity that means that rather than link to a page that has information of relevance, it is better to have no link at all. If the page needs to be imported, rather than just revert a link, how about getting said page imported. Billinghurst 07:58, 5 December 2009 (UTC)

DEFAULTSORT

Detail of sorting

(Reviving my unanswered question)

How does it sort pages that have the same sort key? PAGENAME? FULLPAGENAME? or something generally less useful, such as date of last edit? Robin Patterson 14:57, 21 July 2009 (UTC)

Robin Patterson 04:46, 1 January 2010 (UTC)

{{CURRENTWEEK}}

Is it normal that {{CURRENTWEEK}} (32) displays the 53th week of 2009 when it's the 1st of 2010? JackPotte 19:32, 1 January 2010 (UTC)

Yes, 2009 contain 53 weeks.Crochet.david 16:51, 3 January 2010 (UTC)
So we should notify that {{CURRENTWEEK}} respects the rule to change the 2nd week following the 1/01, unless of it's a Monday? JackPotte 18:24, 3 January 2010 (UTC)

Page name of transcluded page

Is there a way to automatically display the name of a page that has been transcluded into another page? If I use the {{FULLPAGENAME}} or {{PAGENAME}} magic words, I get the name of the page into which it has been transcluded. For example, if Example/subpage is transcluded into Example, they will show "Example", but what I want to display is "Example/subpage", so I can see what subpage is being used. Can this be done without hardcoding the name? RL0919 22:19, 23 February 2010 (UTC)

No; you'll need to hardcode the name into the subtemplate to get it to stay static. Happymelon 23:39, 23 February 2010 (UTC)
This JS code has been proposed as a gadget for that. JackPotte 21:57, 24 February 2010 (UTC)

Page name: keeping only the main title of the sub-page name

Hello. Is it possible to discard one part between brackets from a sub-page name, keeping only the main title?
Example: keeping only “Foo” from “Title/Foo (bar)”
Thanks. 200.163.4.66 14:59, 2 March 2010 (UTC)

Not really; you could hack something up with ParserFunctions and/or StringFunctions. Happymelon 23:12, 2 March 2010 (UTC)
OK

tagname

Can this page link to some explanation of what "tagname" means in the #tag: function? Better yet, a specific example? Wnt 09:44, 4 March 2010 (UTC)

PAGENAME for pages with underscore

The en:tz database contains identifiers containing an underscore. Templates, e.g.

store data to make it accessible via includes.

Works fine at

But not at

Any magic word that can deliver the name with underscores, as in the URL?

TimeCurrency 00:33, 13 March 2010 (UTC)

Check the functions listed under Help:Magic words#URL data. Hamilton Abreu 01:32, 13 March 2010 (UTC)
I see nothing that would output "America/Santa_Isabel". I also tried whether {{DISPLAYTITLE}} would return its value - it does not. TimeCurrency 14:50, 13 March 2010 (UTC)
Misunderstood the question. Appending "E" to the magic word name should achieve the desired result:
{{PAGENAME:America/Santa Isabel}} → America/Santa Isabel
{{PAGENAMEE:America/Santa Isabel}} → America/Santa_Isabel
{{PAGENAME:America/Santa_Isabel}} → America/Santa Isabel
{{PAGENAMEE:America/Santa_Isabel}} → America/Santa_Isabel
Sorry about that. Hamilton Abreu 15:46, 13 March 2010 (UTC)

Great news, thank you. Also thank you for giving the list here. In fact I was thinking about PAGENAMEE, but Help:Magic_words#Page_names says "URL-encoded" values, which is incorrect, details at en:URL encoding. But I don't with which words to correct this. TimeCurrency 02:39, 14 March 2010 (UTC)

NUMBEROFACTIVEUSERS

Hi - can anyone tell me how NUMBEROFACTIVEUSERS (= 1,544) is defined? And can it be adjusted in e.g. LocalSettings? --Robinson Weijman 08:51, 15 March 2010 (UTC)

From what can be gathered in Release notes/1.15, it "is like NUMBEROFUSERS, but uses the active users data from site_stats." Special:Statistics indicates that it is registered users who have performed an action in the last 30 days. Hamilton Abreu 13:50, 15 March 2010 (UTC)
Aha, thanks Hamilton - very useful. --Robinson Weijman 12:53, 16 March 2010 (UTC)

can someone get #tag to work with the include tags?

I know #tag is supposed to work for extension XML tags, but can someone add support for <noinclude>,<includeonce>,<onlyinclude>, and <nowiki>? Thanks. Manishearth 02:21, 20 March 2010 (UTC)

Stuff inside a nowiki #tag is [[properly escaped]] (except template stuff) . noinclude etc aren't handled the same way as other XML tags. Happymelon 18:41, 20 March 2010 (UTC)

CURRENTTIME family not affected by prefernces

No matter what I set my user preferences to, the CURRENTTIME family of magic words always seems to return UTC; both here and on my 1.15.1 local installation.

Is this a bug, a misdocumentation, or am I just doing it wrong? :) --WeaverThree 18:52, 23 March 2010 (UTC)

Page content does not change based on user preferences like that. It would invalidate cache horribly. Splarka 07:54, 24 March 2010 (UTC)
Yeah, I realized that after I went in there to see if I could "fix" it :). The only way it even seems possible would be if the parser left a marker in the output that say the skin code search-and-replaced with the proper value (since monobook.php appears to use user preference when adding the "last edited on" footer...?), and that just seems all kinds of messy-bad. Should the help just say "currenttime etc returns UTC time" then? --WeaverThree 12:47, 24 March 2010 (UTC)

Big redundancy

This page and its translations are to my mind to merge with meta:Help:Magic_words. JackPotte 11:21, 25 April 2010 (UTC)

Other way round. This is the master copy of the MediaWiki documentation (the one which will be kept up-to-date by the developers as the software changes); the content from meta should be merged here. Happymelon 16:19, 25 April 2010 (UTC)
I agree but unfortunately I can't import them here with my user account and meta still hasn't got the same consensus. JackPotte 17:38, 25 April 2010 (UTC)

(SOLVED) Username

Is there any magic word which would username of return currently logged user?

Or his IP adress? --88.102.135.201 15:21, 18 May 2010 (UTC)

Check answer to Help_talk:Extension:ParserFunctions#Check Username Hamilton Abreu 15:56, 18 May 2010 (UTC)
Well, that exactly what I didn't wanted. That writes name of who made last edit on such page, which is almost like signature. I need username of user who is just reading that page. --88.102.135.201 17:25, 18 May 2010 (UTC)
...like for example for welcoming user by his name right on Main Page --88.102.135.201 17:48, 18 May 2010 (UTC)
I was looking for a MediaWiki-function like this, but I was told that there is none. But hey, if you find it - please tell me. :-) May be there is an extension which provides the username of the visiting user. I didn't check this, because installing an extension is no option at the wiki I was working on. -- Oculus Spectatoris disputioe-mail 23:32, 18 May 2010 (UTC)

I think I found PHP variable, which contains username, however I wasn't able to create own Magic Word (not even normal static text). If you help me, I might be able to advance it into Magic Word containing username.. --88.102.135.201 00:12, 19 May 2010 (UTC)

So, using manual didn't helped me. However, I was able to tweak Extension:UserInfo and add this into it. However, it seems like these custom variables gets parsed and stored, as neither original variables or my experimantal one doesn't seem to react to logining as different user, change of browser... --88.102.135.201 01:23, 19 May 2010 (UTC)
Moreover, there is Extension:WhatIsMyIP, which is not installed on this Wiki. JackPotte 04:59, 19 May 2010 (UTC)
That might work, again I made it to show username. However, I cannot include special pages in other articles, including Main_Page, which means it doesn't really help. --88.102.135.201 09:15, 19 May 2010 (UTC)

I guess I know, why it didn't worked. PHP variable from which my experiments are fetching username is probably processed after parsing of document, which means it might not be ok...--88.102.135.201 10:43, 19 May 2010 (UTC)

This might be of no help either, but [[Special:MyPage]]Special:MyPage takes you to the user's own user page. If you can figure out how that's done, therein might lie the answer. Hamilton Abreu 11:25, 19 May 2010 (UTC)
Most promising would be that Extension:WhatIsMyIP, I already managed to make it display current username correctly. However, if I try to treat that Special page as template and include it on normal page, it doesnt work. Only page I was able to include was Special:AllPages
Thats probably closest solution so far, I only need to include it. --88.102.135.201 11:54, 19 May 2010 (UTC)
Almost solved. class WhatIsMyIP extends SpecialPage { needed to be extended into class WhatIsMyIP extends IncludableSpecialPage { , now it almost works, username is correct, only thing I need is to get rid of line-breaks. --88.102.135.201 12:21, 19 May 2010 (UTC)

Okay, it seems like it still needs some work: There is a problem with OutputPage.php.

I can sort of include it on page, but if I want something more like IF or use it as part of link or such things, its doesn't work... :-( --88.102.135.201 13:56, 19 May 2010 (UTC)

Well, I finally managed to make it work. It took a bit of combining extensions, using magic words and special pages, molding it through styles and templates... but now I can process username with {{#ifeq:{{USERNAME}}}} or place it in link {{User:{{USERNAME}}}}. I tested it, any user I log in as different users, logged out.. tested from different computer.. process output with functions... fully working. If you are interested, I'll write a manual how to make it work. --88.102.135.201 11:24, 20 May 2010 (UTC)
Congratulations! :-) But... If I understand your report correct, then the result of your hard work is an extension that needs to be installed - which means it is on the first hand available for "private" operated wikis? Then you could nominate it at usability.wikimedia.org>Wikipedia Usability Initiative>Environment Survey to get it to the Foundation wikis too. Or is it just handful of code to improve the Mediawiki-software? Then it might be a good idea to look directly at the Developer hub here on Mediawiki. I'd like to use it someday! -- Oculus Spectatoris disputioe-mail 15:20, 20 May 2010 (UTC)

Currently it is just bunch of manually upgraded extensions working together, I will refine it into something better and upload it, but I already have lot of other work ahead, so it might take a while. --88.102.135.201 16:27, 20 May 2010 (UTC)

List of Tables and Figures

  1. Is this the best place to ask for enhancements to Mediawiki magic words?
  2. Anyhow, could we please have __LOT__ and __LOF__ added for "list of tables" and "list of figures"? Maybe also __TOC+T__, __TOC+F__, __TOC+TF__ for ToCs with tables or figures or both included and __LOTF__ for a common list of tables and figures. Crissov 12:30, 5 July 2010 (UTC)
No, this isn't the best place to ask for enhancements to Mediawiki magic words. The best place is mw:Project:Support_desk. When you edit this page you see a banner (the one that reads "Please do not post support questions here.") that tells you more about your options. ;-) Vale, Oculus Spectatoris disputioe-mail 13:42, 5 July 2010 (UTC)
I saw that, but wasn't sure whether "support" covered enhancement request. — Christoph Päper 17:33, 5 July 2010 (UTC)

PAGESINCATEGORY doesn't work on my site.

I cannot seem to get the PAGESINCATEGORY magic word to work. My wiki treats it like its a Template.
Is there a setting that needs to be set somewhere to make it work? My Wiki Version is 1.13.1
I note that it works here: {{PAGESINCATEGORY:Help}} = 158

I can't help with your issue, but just to note that {{PAGESINCATEGORY:Help}} = 158 is wrong as there are (at present) 61 pages and 1 category. Is there a parameter to tell this function not to include categories? NinjaKid 20:48, 31 July 2010 (UTC)

DISPLAYTITLE

Something that isn't documented is the fact that {{DISPLAYTITLE}} works only in some namespaces (tested on 1.16.0).--188.109.252.74 12:06, 20 August 2010 (UTC)

Creator

Is there a variable where it shows who made the first edit (creator) of a particular page? Rehman 02:39, 24 December 2010 (UTC)

No, not at the moment in the core. Krinkle 13:16, 24 December 2010 (UTC)

Uploader

Is there a magic-word/template where it shows the uploader of a particular file? This would be most helpful when dealing with files, especially on Commons. Rehman 10:38, 8 January 2011 (UTC)

Transclusion

Please see

I tried clarifying the intro of Help:Magic Words.

"Page-dependent magic words will affect or return data about the current page (by default), even if the word is added through a transcluded template or included system message. For example; {{FULLPAGENAME}} will always give the name of the page it is written on originally, even if displayed on other pages via transclusion."

I added the second sentence. The first sentence is really confusing. I am still not sure. Maybe Wikia is different. --Timeshifter 23:10, 26 January 2011 (UTC)

Number of days in a month

Could you please let me know if we have a magic word gives number of days in a month? Example this month (May) have 31 days. Thank in advance!--Cheers! 02:03, 14 May 2011 (UTC)

time of last revision

w:en:User:Omtay38/sandbox/Archive_10#Even_easier_than_that.21

Updated: {{ #time: F j, Y "at" G:i:s |{{REVISIONTIMESTAMP}} }}

Updated: February 3, 2026 at 9:20:18

Just granpa 02:45, 14 May 2011 (UTC)

Getting the username

Is there any way to detect the username of the person looking at a given page, so you could have the code respond "Greetings, <username>" for example? This is a basic programming exercise, so I was surprised that there doesn't seem to be any documented way to do it with Mediawiki, unless I just haven't been looking in the right place.

Yes, I am looking for the same thing, but for multiple other reasons.. I am looking for some kind of {{Currentuser}}, I am also looking for some kind of {{NumberOfEdits|(user)}}
I'd like to be able to make a welcome template that uses something like:
== Welcome! ==
{{post|1=0|2={{<includeonly>subst:</includeonly>yoursig}}|3=
May I extend my warmest welcomes and offer you any help you may need? Thanks for your {{NumberOfEdits|{{CurrentUser}}}}
 {{plural:contribution|{{NumberOfEdits|{{CurrentUser}}||s}}, {{gender:{{CurrentUser}}|Mr.|Ms.|}} {{CurrentUser}}!

If you need help with something...
:...I'm always available! You can drop a message on [[User_talk:{{{1}}}|{{gender:{{{1}}}|Mr.|Ms.|}} {{{2|{{{1}}}}}}'s user
 talk page]] (which I watch like a hawk) or grab my other contact info on my [[User:{{{1}}}|{{gender:{{{1}}}|Mr.|Ms.|}}
 {{{2|{{{1}}}}}}'s user page]].
:...There's a wealth of wiki documentation on  the [[enter:Help:Contents|meta wiki]], perhaps some of it may be of use to you.
:...There's a really good '''[[enter:Introduction|Introduction]]''' over on meta also, it should help you figure out what's
 going on if your new to wikis in general.

I'd like to hear a reply! Just click '''Edit''' above, and write a message under where mine ends - then, at the end of your
 message (on the same line) type four tildes (Like this: {{4tildes}}) to automatically insert a nickname linked to your user
 page, and a date/time signature!

Again, welcome to the wiki - and I can't thank you enough on behalf of the community for your help in making us the best DDO
 site around {{face|wink}}}}
Which uses {{Welcome|(Login of sysop)|(display name of sysop if different)}}
Technical 13 19:09, 22 June 2011 (UTC)

{{DISPLAYTITLE:title}} does not affect title shown while previewing

This confused me for a bit because I thought I was doing something wrong -- the {{DISPLAYTITLE:title}} magic word only changes the title that is shown when viewing a page, not when editing. It would probably be a good idea to indicate this in the documentation.

What I'm wondering is: are there any other magic words for which this is true but not obvious?

--Woozle 23:26, 23 June 2011 (UTC)

{{PAGESINCATEGORY}} counts sub-categories

Is there anyway to count only pages in a category, rather than pages and sub-categories? Eladkse 16:49, 11 July 2011 (UTC)

{{SERVERNOWIKI}}

To report the server without reporting it as a link the following template can be used :

{{#replace:{{SERVER}}|:|& #58;}} (remove space between "& #")

Useful for getting the server to be passed as a variable to java or object 188.222.137.154 10:36, 17 July 2011 (UTC)

Default user for gender tag

The gender tag should be enhanced to enable using the current username when none is provided. Otherwise, this tag is quite useless.

--DavidL 12:49, 30 September 2011 (UTC)

nowiki parameter in filepath

What is |nowiki parameter in {{filepath:}} supposed to do? Gustronico 16:33, 8 October 2011 (UTC)

Magic Word to reference Section Header Name

Is there any possibility to get the header name of the section - like {{SECTIONNAME}} as you can show the article name with {{PAGENAME}}? I am pretty sure I would have stumbled upon it if it was as easy as just using a magic word for it, but I could not even find an extension that provides it. I can't believe noone was in need for this before... Can anyone point me to something? Thanks a lot --Achimbode 16:04, 13 October 2011 (UTC)

Is magic variable expansion an atomic operation?

I cannot find it mentioned anywhere, hence the question: Is the expansion of mediawiki magic variables an atomic operation for the whole page? If so, is this "by accident/side-effect", or is MediaWiki deliberately coded to guarantee this under all circumstances (that is, also, if no caching is used)? I wonder, if the contents of variables could change during the time it takes to process a page.

To illustrate this, assume it would take some while to process a huge page containing a {{CURRENTTIME}} at the beginning and the end of the page. Will both magic variables be expanded to the same value, even if the second rolls over in the meantime?

The background to the question is the observation, that various Wikipedia templates use the {{CURRENTYEAR}}, {{CURRENTMONTH}}, {{CURRENTDAY}}, {{CURRENTTIME}} and similar MediaWiki variables to compose more complex date representations for a multitude of purposes. Example for a template to display the ISO 8601 date:

{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}}

Now, if MediaWiki would not guarantee that all these variables do not change while the template is being processed, such a template would produce faulty output if executed in the very moment, when the month rolls over. In this moment, it could still output the old month (and year), but the new date. Example: If 2011-11-30 rolls over to 2011-12-01, the template might emit 2011-11-01 instead. If 2011-12-31 rolls over to 2012-01-01, the template might emit 2011-12-01 or 2011-01-01 instead.

It would be possible to create the same ISO 8601 output by processing the contents of the {{CURRENTTIMESTAMP}} variable instead, however, this is more complicated to code, and most of the existing templates to do take this route. So, do all these templates just work "by accident" (since the rollover is a relatively rare event) or does the MediaWiki variable expansion takes care of this by design? Thanks. --88.77.205.254 18:16, 7 November 2011 (UTC)

All of them are replaced with the same timestamp, provided by ParserOptions::getTimestamp(), so there won't be such rollover effect. Platonides 18:50, 7 November 2011 (UTC)
Thank you for the quick answer. --84.63.108.166 19:54, 7 November 2011 (UTC)

nowiki parameter in filepath

What is nowiki parameter in {{filepath:}} supposed to do? Given examples don't show any difference:

  • {{filepath:Wiki.png}} → //upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png?utm_source=www.mediawiki.org&utm_campaign=index&utm_content=original
  • {{filepath:Wiki.png|nowiki}} → //upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png?utm_source=www.mediawiki.org&utm_campaign=index&utm_content=original

Gustronico 15:30, 17 November 2011 (UTC)

They look the same because of the configuration used on Wikimedia sites. These examples should make it more clear what the nowiki parameter does:
As you can see, nowiki prevents the automatic linking of the returned URL. But on Wikimedia filepath returns a protocol-relative URL, which are not automatically linked anyway. Thus, the result is the same. Reach Out to the Truth 19:38, 17 November 2011 (UTC)
Thank you. There is no info about this parameter in the help page. I think it should be named nolink instead. Gustronico 19:59, 18 November 2011 (UTC)
Automatic url linking is not a wiki markup related feature, but a general web practice instead, so "nowiki" make no sense here. It should be better named "nolink". Gustronico 16:23, 19 November 2011 (UTC)

ProtectionLevel prior to 1.15

I am currently investigating a wikia site to see what needs to be done. Caveat is they have 1.13.2 (r1) and the ProtectionLevel magic word wasn't implemented till 1.15.

How do i either create the template PROTECTIONLEVEL that returns the similar results or can substitute the MagicKeyword with an equivalent operation?

I know this is taking a huge step backwards but is what i have to work with.

Thank you in advance Goldbishop 03:00, 21 January 2012 (UTC)

Is there some reason why an upgrade has not been done? The PHP version is < 5.1 perhaps. Try typing Special:Version into the search bar and let us know. Allen4names 05:13, 21 January 2012 (UTC)
Its not mine to upgrade, just mine to deal with as i am sharing developement responsibility.
If it was mine to administer solely or immediately, i would upgrade by all means.
Since it is not, i need to incorporate a mechanism that will handle this feature since the Magic Word wasnt implemented.
Goldbishop 14:01, 21 January 2012 (UTC)
If you have Extension:Parser Functions installed a modified version of wikipedia:Template:After should do the trick. In any case please contact whoever has system administrator privileges and ask that an upgrade be performed. Allen4names 16:52, 21 January 2012 (UTC)

possibility like {{USERNAME}}

is there a variable or possibility for showing the own username (every logged in person should see your own name)?

Not without an extension (There are several that do this). This would break caching (because every user would have to see a different version of the page) so it's not happening in core mediawiki. Bawolff 15:28, 13 February 2012 (UTC)
Can someone link me to one of these extensions?

interface language

is there a function or possibility for showing the own user-interface-language (every person should see your own interface language)?

Sort of. {{int: is per interface lang, and some folks (Commons in particular) have made things like commons:template:autotranslate out of that. Bawolff 15:29, 13 February 2012 (UTC)
Thank you! With that describtion, it works perfect :-) Mediawikitester 11:54, 14 February 2012 (UTC)

Is there a {{USERLANG}} function similar to {{CONTENTLANG}}?

I have an external link that I want to post on my wiki that I know will be used internationally and I want to be able to have the link not default to en. This link (http://www.google.com/#hl=en&q=free+mmo+guild+hosting&pf=p&output=search) I wanted to make it read http://www.google.com/#hl={{USERLANG}}&q=free+mmo+guild+hosting&pf=p&output=search instead of assuming everyone comprehends "en". Can this be done? -- Technical 13 (talk) 00:18, 25 March 2012 (UTC)

It's possible with Extension:Translate (no, you can't use it on Wikipedia), see also m:Help:System_message#Branching_based_on_the_user_language. In your example, just remove the hl=en part and let Google guess the language of the user (they'll surely know better). --Nemo 11:41, 25 March 2012 (UTC)

Is there a way to get the post-expand {{PAGESIZE:page name}}?

I have a page on the wiki I'm a sysop of that is pushing a post-expand size of 1.25MB (Monster Information/All) that I want to keep an eye on on my user page. However, this is a tiny page in of itself being build as an transclusion of 21 or so other pages. Is the only way for me to do it to build an {{#expr:{{PAGESIZE:main page name}}+{{PAGESIZE:first transclude page name}}+{{PAGESIZE:second transclude page name}}+{{PAGESIZE:...}}+{{PAGESIZE:last transclude page name}}}}??? -- Technical 13 (talk) 15:45, 10 April 2012 (UTC)

Update: I put together the "(~{{formatnum:{{#expr:ceil({{#expr:{{PAGESIZE:Monster_Information/All|R}}+{{PAGESIZE:Monster_Information/Header1|R}}+{{PAGESIZE:Monster_Information/1|R}}+{{PAGESIZE:Monster_Information/2|R}}+{{PAGESIZE:...|R}}+{{PAGESIZE:Monster_Information/20|R}}}}/1024)}}|,|3}}kB)" which only reports 1/5 of the page size because it still doesn't include the multiple uses of each template per page.. So that work-around doesn't even work.. Anyone have a suggestion? -- Technical 13 (talk) 15:58, 10 April 2012 (UTC)
Bug 35908 created -- Technical 13 (talk) 12:29, 12 April 2012 (UTC)
And closed "invalid". If you get an answer, please post it here. Rd232 (talk) 09:45, 23 April 2012 (UTC)
Then re-opened as a feature request and an importance change from normal to enhancement. -- ShoeMaker   ( Contributions Message )   19:23, 25 April 2012 (UTC)

__NOEDITSECTION__ work in 1.18.3?

hi, i update mediawiki from 1.18.1 to 1.18.3, and __NOEDITSECTION__ not work in my wiki. (this closed wiki, i dont show link)--Pastakhov (talk) 17:18, 27 April 2012 (UTC)

Without being able to see your wiki, I'm not sure how to help you. If you could make a demo of the problem, that would help a lot, especially if you need to report it as a bug. Badon (talk) 04:25, 28 April 2012 (UTC)

magic word for current url/page

Is there a magic word that can be used for a global header so that it grabs the current page or url for any given page?

Using {{fullurl:{{FULLPAGENAME}}}} on this page will render as //www.mediawiki.org/wiki/Help_talk:Magic_words. Allen4names (talk) 04:01, 28 May 2012 (UTC)
I'm currently using that. But I have my global header setup through the Sitenotice, so that the links always go back to Sitenotice rather than the current page a user is on. Thank you for responding to me! :)

is there any alternative to __NEWSECTIONLINK__ or {{NUMBEROFARTICLES}} in 1.6.10?

doubtful. Rd232 (talk) 17:31, 9 July 2012 (UTC)

{{NUMBEROFVIEWS}}

Q/ {{NUMBEROFVIEWS}} doesn't work on my wiki. You'v got any idea ?

A/ Needs MW 1.14++

signed for archiving purposes. Rd232 (talk) 01:08, 24 June 2012 (UTC)

TOC - hide contents

is there a possibility to hide the content at starting up the page? i saw that it is made with a nice little java script.

probably possible, but not without some coding. Try the Project:Support desk the question should have been directed to in the first place. Rd232 (talk) 17:30, 9 July 2012 (UTC)

Full list?

I'm sure I saw something like __no-rich-editor__ around this website.

I can't find that. It must be provided by one of the Category:WYSIWYG extensions. Rd232 (talk) 17:30, 9 July 2012 (UTC)

anchorencode bug?

HTML anchors must begin with an alphabet character to be valid - they should be of the pattern [A-Za-z][A-Za-z0-9:_.-]*. Shouldn't {{anchorencode: ensure this? ··gracefool 00:26, 24 June 2012 (UTC)

disable rich editor on part of page

Is it possible to use __noricheditor__ only on part of page? (like paragraph?)

No, behaviour switch magic words apply to the entire page. Rd232 (talk) 17:30, 9 July 2012 (UTC)

Section counter

Is there (or is there a plan to include) a magic word for current section number, usable for example in an edit link like [{{fullurl:{{FULLPAGENAME}}|action=edit&section={{CURRENTSECTION}}}} edit this section]? Is this feasible to implement? Kephir (talk) 12:08, 16 August 2012 (UTC)

Template name rather than page name

Is there way to insert the name of the template rather than that of the page it is being transcuded into? Ivan Pozdeev (talk) 19:39, 24 September 2012 (UTC)

No Line

Is there any magic word to remove the horizontal lines which locate after each heading? --Yoosef Pooranvary (talk) 00:13, 9 August 2012 (UTC)

There is no magic word for such a thing. That is handled by the skin's css, which you may change if you have access to the skins and your intent is to remove them for everyone. If you do not have access or do not want to remove them for everyone, you may add a section of code to your User.css to remove them. You will simply add something like:
h1, h2, h3, h4, h5, load.php @media screen h6{border-bottom: 0;}
I hope this helps you. -- ShoeMaker   ( Contributions Message )   12:44, 15 February 2013 (UTC)

Scope of NOEDITSECTION not clear

In the documentation it is suggested that NOEDITSECTION may work on one section only. My experience however is that if you put one NOEDITSECTION on a page all sections are non editable. I would prefer it possible to select which sections are editable and which not, but I see no way how to do this. Is there a way to do this? --AdSvS (talk) 13:34, 3 October 2012 (UTC)

Padleft with spaces

How do you force padding with spaces? I've tried &nbsp; and <span> tags, but they only pad one character and stop.

Not sure exactly what you are hoping to do, but have you tried &#32;? Might even require a combination of an alternation of padding with &nbsp;&#32; Also, I'm thinking it is another possibility that the parser is parsing it out more than once and you should maybe try <nowiki> </nowiki> -- ShoeMaker   ( Contributions Message )   18:59, 18 February 2013 (UTC)

Case Manipulation

Is there currently any method available to format a string with w:Start Case? I know there is {{uc: to transform string to upper case, {{lc: to transform string to lower case, {{ucfirst: to transform first character to upper case, and {{lcfirst: to transform first character to upper case. What I am looking for is something like {{sc: to transform a string into start case (This Is Start Case Style). If there is currently nothing, I'll put in a feature request on Bugzilla, I just figured I would ask here first. -- ShoeMaker   ( Contributions Message )   19:10, 13 February 2013 (UTC)

Pending change level

This page needs to be updated with {{PENDINGCHANGELEVEL}}, but I'm not sure that I could describe it accurately myself. Does anyone know who the right person to ask is? Mr. Stradivarius (talk) 10:17, 15 February 2013 (UTC)

First off, what is a {{PENDINGCHANGELEVEL}}? I've tried searching the text for anywhere on this wiki and en.wikipedia and can't find a thing referring to that. It looks like some kind of Magic Word or Template, but I can't find it on the Help:Magic Words page or in the Template namespace.
Secondly, what is the change that you think condones a {{PENDINGCHANGELEVEL}}?
-- ShoeMaker   ( Contributions Message )   19:15, 18 February 2013 (UTC)
PENDINGCHANGELEVEL is a magic word that shows the level of pending-changes protection active on the current page. It's already implemented, it's just not documented here yet - I revised a meta-template for protection icons using it on en.wiki (en:Template:Pp-meta). On the template talk page, someone pointed to this page where it was apparently put into MediaWiki, but I don't really understand the code review process or localization issues, so I thought I'd ask before adding it to the page in case I got it wrong. Best --Mr. Stradivarius (talk) 03:01, 28 March 2013 (UTC)
Does that magic word belong to the core (or core set of extensions)? I would think it is part of Extension:FlaggedRevs' Special:PendingChanges. No? Either way, I don't see this MAG listed on Special:Version with the rest of the MAGs. T13   ( C • M • Click to learn how to view this signature as intended ) 10:34, 28 March 2013 (UTC)
It's extension specific so probably belongs on in the extension docs. Note afaik special:version only lists parser functions not variables and this one is a variable. Bawolff (talk) 11:31, 28 March 2013 (UTC)
Wouldn't it be in the same group as ... numberofedits, numberoffiles, numberofpages, numberofusers, numberofviews, padleft, padright, pagename, pagenamee, pagesincategory, pagesize, plural, protectionlevel, ... ? Technical 13 (talk) 12:06, 28 April 2013 (UTC)

Option NOSEP in formatnum

What does it do? See translatewiki:Thread:Support/Magic_Word_"NOSEP". --Nemo 21:24, 29 March 2013 (UTC)

Reading numbers from titles

Hi. Could anybody help me how to read only numbers from titles with different parametres (e.g. the title is "1256 something" and the template should extract only "1256"; or the title is "something 358 something" and the template should extract only "358")? I tried it by using different magic words, but they appeared to be useless in this case. I'd also like to know if it's possible to create a template that will read the words from the title in a given order (e.g. the title is "Canis Minor" and the template should read only the second word, i.e. "Minor"). Thanks.--Kiril Simeonovski (talk) 07:48, 8 April 2013 (UTC)

Replied here: Project:Support desk/Flow/2013/04#h-Reading_numbers_from_titles-2013-04-07T14:44:00.000Z --Ciencia Al Poder (talk) 09:35, 8 April 2013 (UTC)

{{PAGESINCAT:Foo|subpages}}

Is there an easy way to get the total number of subpages in a category such as {{PAGESINCAT:Foo|subpages}}? This would be useful for keeping track of members of maintenance categories that are segregated by month or year. Technical 13 (talk) 15:44, 22 May 2013 (UTC)

No, and this could be a highly expensive parser function. --Ciencia Al Poder (talk) 09:12, 23 May 2013 (UTC)

Getting display on the page without parsing: mw:Help:Magic words#Other

Hi,

I have mediawiki 1.23 and most of the extension installed, including scribunto, parserfunctions...

Since, the august dump I am getting errors in the page like the page is not able to parser Magic words module. Do you have any idea why is that happening?

Most of the pages are broken.

... 

Gaius Marius colspan=2 style="background-color: lavender; text-align: center" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Consul of the Roman Republic

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-



  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.colspan=2 style="border-bottom:none; text-align:center"#REDIRECTmw:Help:Magic words#Other This page is a soft redirect.In office 107 BC, 104–100 BC, 1 January 86 – 13 January 86 BC #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-








style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Preceded by

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Marcus Aurelius Scaurus #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-

style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Succeeded by

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Quintus Servilius Caepio and Gaius Atilius Serranus #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-


  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-


  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-

colspan=2 style="background-color: lavender; text-align: center" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Personal details

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-

style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Born

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. ca. 157 BC Arpinum, Roman Republic #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-

style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Died

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. January 13, 86 BC (aged 70) Rome, Roman Republic #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-


style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Political party

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. populares #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-

style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Spouse(s)

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Julia (paternal aunt of Julius Caesar) #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-


style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Children

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Young Marius #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-



style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Religion

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Roman Paganism #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-


Please consider revising your topic by removing unnecessary white-space and adding content under a registered account so that someone could actually respond back to you directly if they preferred.
--Erutan409 (talk) 13:06, 21 October 2014 (UTC)

{{REVISIONxxx:Foo}}

Is there any way to get revision information using the magic words for another page such as getting {{REVISIONUSER:Foo}} or {{REVISIONTIMESTAMP:Foo}} from [[Bar]]? This would be useful for keeping track of articles in a project for a list of pages. Technical 13 (talk) 15:44, 22 May 2013 (UTC)

No. This can be handled by a DynamicPageList extension, though. --Ciencia Al Poder (talk) 09:11, 23 May 2013 (UTC)
+1 for feature request -- sir KitKat 78.21.21.68 07:38, 15 October 2013 (UTC)

_NOEDITSECTION_ on every page?

Hey there, I am using Mediawiki and I have problems with partly editing of pages, so I want to disable the "edit section" Button for the whole wiki. Is this possible?

If there was such a thing, I would think it would be listed on Manual:Configuration settings (alphabetical), which it is not. However, depending on which version of MediaWiki you are running you could just set the class (use to be .editsection but was recently renamed .mw-editsection on some wikis like en.wikipedia) for to display: none; in your MediaWiki:Common.css -- Technical 13 (talk) 12:48, 15 June 2013 (UTC)

I'd like to be able to do this too

I don't understand the answer saying that you set \<code\> display: none; \</code\> - where would you set that?

Isn't there a switch you can set in LocalSettings.php to change the behaviour so that, by default, all sections are displayed without a edit -- so you'd, instead, need to specify __EDITSECTION__ if you wanted a particular section to display an edit.

Fustbariclation (talk) 08:32, 10 January 2014 (UTC)

  • As I said above, you would add:
.editsection {
    display: none;
}
or possibly, depending on the version of MW you are running:
.mw-editsection {
    display: none;
}
to your MediaWiki:Common.css. Technical 13 (talk) 19:46, 10 November 2014 (UTC)

__DISAMBIG__

Could someone please add the necessary documentation for __DISAMBIG__ (Extension:Disambiguator) here and, if you could be so kind, also at en:Wikipedia:Magic words? Thank you. -- Michael Bednarek (talk) 13:48, 11 July 2013 (UTC)

  • I was under the impression that this page was reserved for core (or at least ships with core extension) magic words and I don't remember seeing Extension:Disambiguator being in that package. Is this going to be a new inclusion in the default package? Technical 13 (talk) 10:26, 17 July 2013 (UTC)
    • When I look up magic words on the EN Wikipedia, I often end up looking at Help:Magic words here on MediaWiki, because that page is linked there, e.g. at en:Help:Magic words. My impression, which may well be wrong, is that MediaWiki documents the MediaWiki software. If that is not so, feel free to remove the entry about __DISAMBIGUATE__ again; in that case, I wonder whether it would be better to remove the mentioned link to MediaWiki at "en:Help:Magic words" as well. -- Michael Bednarek (talk) 12:21, 17 July 2013 (UTC)

Number of files in Articles

Hi, Is there any way to be able to count the number of files (In my case: Images) shown in article/category? In other words, I want to have the number of occurrence of any [[file:...]] in given article.

TNX --82.80.126.166 13:01, 23 October 2013 (UTC)

Fullurle

The magic word {{fullurle:}} is not described in this page, and I honestly don't know the difference between that and {{fullurl:}}. Cainamarques (talk) 21:32, 6 December 2013 (UTC)

Displaying the article's author on the page

Is there any magic word for that? For example {{REVISIONUSER}} displays the username/IP of the last user, who edited the article. How to display the username/IP of the user, who created the article?--185.31.48.30 09:45, 17 April 2014 (UTC)

No. That would be an expensive operation, as MediaWiki should find the first revision of the current page. --Ciencia Al Poder (talk) 16:53, 17 April 2014 (UTC)

I am also interested in this magic word. Like {{ORIGINALAUTHOR}} or {{PAGEAUTHOR}} and to go with them, the creation date. {{CREATEDYEAR}} and {{CREATEDMONTH}} and {{CREATEDDAY}}. That would help me with my project. Thanks. — Preceding unsigned comment added by Pvodrazka (talkcontribs) 09:18, 9 April 2019 (UTC)

You can try with Extension:ContributionCredits, or Extension:CreditsSource --Ciencia Al Poder (talk) 09:18, 9 April 2019 (UTC)

Adding translatable docu to such a page is horrifying

This diff together with translate tags etc. causes fatals, so I gave up. Sorry for this. The standard nonsense error message "Fatal exception of MediaWiki exception" or what this is called will probably not help digging into the issue. --[[kgh]] (talk) 22:32, 4 July 2014 (UTC)

anchorencode

Did somebody change anchorencode ?

It now seems to strip italic markup, rather than encode it:

{{anchorencode:Glasgow Digital Library, ''Omond House''}} -> Glasgow_Digital_Library,_Omond_House

It just means that on en-wp, we have to clean up a few hundred articles where en:template:SfnRef (which uses anchorencode to generate anchors in footnotes) has anchors that are generated from italicised words. --RexxS (talk) 16:30, 6 July 2014 (UTC)

Variables that affect behaviour

Why are {{DISPLAYTITLE:title}} and {{DEFAULTSORT:sortkey}} listed under Variables when they do not "return information about the current page, wiki, or date"? Surely, since they "control the layout or behavior of the page", they should be listed at Behavior switches. This has come up at w:en:Help talk:Magic words#Three "behavior switches" that aren't. --Redrose64 (talk; at English Wikipedia) 10:14, 17 July 2014 (UTC)

I surmise it's because "switches" have a special __FORMAT__ that doesn't accommodate parameters, whereas DISPLAYTITLE: and DEFAULTSORT: require them. Of the "variables" listed on this Help page, those that take parameters use them only to specify the object about which the "variable" should return information. As DISPLAYTITLE: and DEFAULTSORT: use parameters to set environmental states rather than report them, they are certainly a special case. Maybe they (along with NOEXTERNALLANGLINKS:) should be described as "environment variables", "behavior variables", or "behavior functions", and be placed in their own section or subsection in the page.
My suggestion at this point would be to rename the current "Behavior switches" section to "Behavior settings", move the current content of that section into a subsection called "Behavior switches", and add a second subsection called "Behavior functions" where DISPLAYTITLE:, DEFAULTSORT:, and NOEXTERNALLANGLINKS: are explained. I would also suggest that the list of "general types of magic words" in the lede be rewritten accordingly, mentioning the differences in effect, as well as in format, of the various kinds of magic words.
As an aside, I note that the keywords called "variables" on this Help page would probably be more accurately described as "functions", as they are used to return values that report some aspect of the environment, rather than to store arbitrarily-assigned values. But I guess that's a whole 'nother ball o' wax. — Jaydiem (talk) 16:56, 17 July 2014 (UTC)

Pages in category + sub categories

Is there a deeper penetrating {{Pagesincategory that will also count the pages in the subcategories? That would be wonderful. Kmath87 (talk) 22:02, 8 August 2014 (UTC)

  • Not built in to the parser, Kmath87, no. You will have to use a recursive template, some kind of E:Loops, Lua (scribunto if I spelled that right), or javascript via the api if you want to have a count of all pages in a category & subcats. Technical 13 (talk) 12:14, 9 September 2014 (UTC)

What is the opposite of 41027?

If I know the page ID number, how do I find the page?

I see that, if I have the page name, the 41027 will give me the number, I'd just like to do it the other way around.

197.155.4.118 09:08, 20 August 2014 (UTC)

Missing magic words

It looks like the following magic isnt listed:
{{CURRENTMONTH1}} gives 8
{{CURRENTMONTH2}} gives 08
{{LOCALMONTH1}} gives 8
{{LOCALMONTH2}} gives 08
{{ARTICLEPATH}} gives /wiki/$1
{{ROOTPAGENAME}} gives Magic words
{{ROOTPAGENAMEE}} gives Magic_words
Christian75 (talk) 07:30, 30 September 2014 (UTC)

Maybe because the first four are considered the same as
  • {{CURRENTMONTH}} gives 08
  • {{LOCALMONTH}} gives 08
As of today, the last two have been included on the page. Bennylin (talk) 10:14, 10 December 2014 (UTC)

Magic Word '{{!}}'

When I created the template for this magic word, I was having an issue using it with tables when I passed them in parameters for templates. I was using the <noinclude /> syntax for specifying why I created the template. One thing to note is that the '|' character must come immediately after the closing tag. Otherwise, the white space messes up the parsing of the character when being used in tables; at least for what I was using it for. A newline simply doesn't cut it.
--Erutan409 (talk) 14:48, 5 October 2014 (UTC)

I have the same issue, have you found the solution?... Crystian

Proposition of text changes and errors.

  • In {{CASCADINGSOURCES:page name}} page name is nor translatable.
  • Where says:
    • "exactly as formatnum formats them with the wiki's locale" must be "exactly as formatnum formats them with the wiki's locale"
    • "are changed; formatnum will only transform" must be "are changed; formatnum will only transform"

--Jmarchn (talk) 06:26, 10 October 2014 (UTC)

Magic word print username??

There is some word that prints the username of the user who is seeing some page where is that MAGICWORD?-- Crystian Marquez

Crystian Marquez, Did you find any solution? --Mavrikant (talk) 16:34, 22 February 2015 (UTC)

Creation date

How can i get the "creation date" of a page? ... There exist some MAGICWORD?... or there exist a parser for get the creation date of a page?

I don't think that's possible by current Magic words. Bennylin (talk) 10:01, 10 December 2014 (UTC)

{{filepath:file_name.pdf}}

How to create a filepath for a specific page in a PDF or DJVU? It only accept one parameter, thumb size, and right now it only works for the first page of the PDF. Thanks. Bennylin (talk) 08:54, 10 December 2014 (UTC)

My current workaround on includes\parser\CoreParserFunctions.php (MW 23.1) is by adding the third argument ($argC) and one line of code. So now I could call the thumbnail for page 2 of the PDF {{filepath:file_name.pdf|100px||2}}. I'm not sure this is the best solution though. Bennylin (talk) 09:58, 10 December 2014 (UTC)
	public static function filepath( $parser, $name = '', $argA = '', $argB = '', $argC = '' ) {
		$file = wfFindFile( $name );

		if ( $argA == 'nowiki' ) {
			// {{filepath: | option [| size] }}
			$isNowiki = true;
			$parsedWidthParam = $parser->parseWidthParam( $argB );
		} else {
			// {{filepath: [| size [|option]] }}
			$parsedWidthParam = $parser->parseWidthParam( $argA );
			$isNowiki = ( $argB == 'nowiki' );
		}
		$parsedWidthParam['page'] = $argC;

Magic Word for IP address lookup

Are there any magic words to look up someone's IP address? 47.20.96.42 19:53, 28 December 2014 (UTC)

There is a special user right to get this data at all (checkuser or oversight, I always forget what is what). IOW, no. –Be..anyone (talk) 11:47, 29 December 2014 (UTC)

language magic word

It would appear that {{#language:<code>|en}} where <code> is an ISO 639-3, three letter language code, either doesn't work as it should or that the documentation, such as it is, that suggests that ISO 639-3 language codes should work, is incorrect:

{{#language:ara|en}} → ara

As a check, switching to ISO 639-1 works:

{{#language:ar|en}} → Arabic

So, the questions are:

  1. Should {{#language:}} return a language name for three character ISO 639-3 language codes?
    1. If no, shouldn't the documentation state that {{#language:<code>|en}} only supports ISO 639-1?
    2. If yes, where is the error and how does it get fixed?

Trappist the monk (talk) 19:09, 10 January 2015 (UTC)

1.1 no: The docu shouldn't say only, e.g., {{#language:tlh|en}} gives Klingon. Some ISO 639-3 three letter codes have older ISO 639-1 two letter codes. From the work on RFC 4646 (predecessor of RFC 5646) I recall that ar and zh were the worst cases. Check out section 2.2.2 in 5646 about "macrolanguage zh". Admittedly arb also doesn't work, maybe the logic is "support only the shortest code". –Be..anyone (talk) 07:28, 13 January 2015 (UTC)
I'm confused. We aren't talking about language sub-tags; the documentation for {{#language:<code>|en}} makes no mention of sub-tags. The documentation says that it "[returns the] full name of the language for the given language code" where 'language code' is vaguely defined as ISO 639-3. Because ara is a legitimate ISO 639-3 code (see at registration authority: ara) {{#language:ara|en}} should return Arabic which the language name assigned by the registration authority, shouldn't it?
Trappist the monk (talk) 14:01, 14 January 2015 (UTC)
ISO 639 macrolanguage != language, if there is a problem it would be arb, not ara. –Be..anyone (talk) 08:45, 15 January 2015 (UTC)

Missing magic word

I just figured out that {{CURRENTMONTH1}} outputs the current month in a non-zero padded format (shown here: 8). The only problem is I am unsure of how to add it to the table without breaking the <translate> tags, as each one is numbered.

--KnightMiner (t/c) 03:33, 22 January 2015 (UTC)

Failed to mark for translation

Failed to mark the page for translation:

Function: MessageGroupStats::clearGroup
Error: 1205 Lock wait timeout exceeded; try restarting transaction (10.64.16.27)

— Preceding unsigned comment added by Shirayuki (talkcontribs)

EXPENSIVE tag

What does it mean when a magic word is tagged as 'expensive' ([EXPENSIVE])? For example, the PAGESINCATEGORY magic word. In the description column, it says:

[Expensive] Number of pages (including subcategories and files) in the
given category. (Category:Help used for demonstration)

I had one thought of what the term 'expensive' means, which was that it ate up a lot of server memory? Or just in general, related to servers? Also, what makes some magic words 'expensive' and others not? Codyn329 (talk) 00:37, 12 March 2015 (UTC)

Check out Special:TrackingCategories and Category:Pages with too many expensive parser function calls, it's a tilt - game over effect. Articles MUST NOT be Turing Machines. Admittedly implementing the Ackermann function with templates is fun.Be..anyone (talk) 17:34, 13 March 2015 (UTC)

urlencode

Is it possible to use this, to construct a link to an external webpage? An example would be greatly appreciated. --[[User:Bmrberlin| Bernd M.]] (talk) 11:26, 31 March 2015 (UTC)

There are three examples in the 2nd column of three, and there's a cheat sheet in the 3rd column: In essence urlencode always does the same thing, percent-encode Unicode, e.g., the input á u+00E1 is encoded as %C3%A1 for UTF-8 C3A1=C000+0300+0080+0021, with C=1100 for length two bytes, 3=0011 for some high bits, 8=10(00) for two bits indicating a tail byte, and 21=(00)10 0001 for six low bits. Putting hi+lo together that is (bits) 0011 10 0001 = (hex) E1 = u+00E1 as expected.
For the space character u+0020 you have to say what you want. Default or QUERY encodes spaces as + suited for, e.g., google queries. WIKI encodes spaces as _ as you would need it for a page#section_link. And PATH percent-encodes spaces as %20, suited for everything else, also known as URL-encoding. –Be..anyone (talk) 22:27, 31 March 2015 (UTC)

{{msgnw:xyz}} doesn't work with hidden comments

I try to include the unexpanded wikitext of a page (this) into another page (this). I use {{msgnw:Namespace:Pagename}}, but I have a problem with hidden comments in the original page. Some are included, others aren't! Can you help me? Thanks in advance. --FRacco (talk) 11:14, 9 May 2015 (UTC)

The visible XML-comment is within a gallery. All other XML-comments never make it into msgnw. Something isn't as it should be, please report the bug. –Be..anyone (talk) 08:27, 9 July 2015 (UTC)

Help! I'm completely stumped!

Hi, I was wondering if anyone can help me out or at least point me in the right direction as to where I can solve this problem. I have imported some pages and templates into my wiki from Wikipedia but they are not displaying correctly. In all the inboxes I get a bunch of errors saying "mw:Help:Magic words#Other"

For the life of me, I can't figure out what the problem is.

Can anyone help me out please.

Thanks

Here's a link: http://games.appipedia.com/wiki/Dizzy_–_The_Ultimate_Cartoon_Adventure — Preceding unsigned comment added by Finalcutbob (talkcontribs)

The problem is one of the included templates of the page. See [3]. --Ciencia Al Poder (talk) 09:31, 2 June 2015 (UTC)

Thanks for your help!

Help for translation

Hello, I recently made changes in this help page, but these changes are not transposed in the other languages. I guess this is related to the header saying "This page contains changes which are not marked for translation.", but I don't know how to mark my changes for translation. Anyone can tell me the way to do that? Best, Wikini (talk) 07:32, 5 June 2015 (UTC)

The message disappeared, I guess that someone made the changes needed. I again make changes in the English version and this message appears again. Best, Wikini (talk) 08:11, 9 June 2015 (UTC)

Behavior switch for auto-numbering section headings

I suggest to create a new __NUMHEADINGS__ behavior switch to force auto-numbering the section headings. It would be useful in votes and polls, and in some structured pages. It should override individual user preferences in the page where it is included. Gustronico (talk) 02:19, 6 July 2015 (UTC)

Already filled on phabricator. --Ciencia Al Poder (talk) 19:05, 8 July 2015 (UTC)

PAGESINCATEGORY intersection

Is there anyway to do a PAGESINCATEGORY intersection with the current magicwords? E.g., incategory:"puzzle video games" incategory:"rareware games" in the enwp search bar shows the intersection between the two categories. I'd like to easily calculate the number of hits for that intersection. – czar 20:53, 3 August 2015 (UTC)

{{PAGENAME: }} and {{filepath: }} don't work well together with apostrophe in filename

{{filepath: {{PAGENAME: File:Our country's report.pdf}} }}

doesn't return a filepath, although filepath does with only the filename and {{PAGENAME: }} does return the right filename.--AdSvS 07:29, 6 August 2015 (UTC)

AdSvS seems to be saying that something should be returned but it returns blank:
  • {{filepath: {{PAGENAME: File:Our country's report.pdf}} }}
The first problem is that File:Our country's report.pdf doesn't exist, and {{filepath:}} always returns a null string for non-existent files. If we try the same thing using the name of a file that does exist, but contains no apostrophes, such as File:ChameleonSkin.png we get the expected result:
  • {{filepath: {{PAGENAME: File:ChameleonSkin.png}} }} → //upload.wikimedia.org/wikipedia/commons/f/ff/ChameleonSkin.png?utm_source=www.mediawiki.org&utm_campaign=index&utm_content=original
Trying a file which exists and also contains apostrophes, such as File:Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png, we get a null string:
  • {{filepath: {{PAGENAME: File:Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png}} }}
If we test each part separately, we see
  • {{PAGENAME: File:Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png}} → Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png
  • {{filepath: Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png }} → //upload.wikimedia.org/wikipedia/mediawiki/3/30/Chameleon_VisualEditor_%27Insert_Media_Dialog%27_Z_Index_Issue.png?utm_source=www.mediawiki.org&utm_campaign=index&utm_content=original
i.e. it is something to do with the combination of the two functions. I think the actual problem is that {{PAGENAME:}} encodes certain characters, i.e. the apostrophe becomes the numeric entity &#x27;. --Redrose64 (talk; at English Wikipedia) 14:37, 6 August 2015 (UTC)
Thanks Redrose64 for the elaboration. That was indeed what I wanted to say and the filename was only an example. But your way is much, much better and I'll think about it when I run into strange things again! --AdSvS 15:51, 6 August 2015 (UTC)
And there's a bug for that! T18474. This happens with other magic words as well. --Ciencia Al Poder (talk) 19:00, 9 August 2015 (UTC)
Thanks, that explains it, Brion added a link to the closed phab:T16779 eight years ago, and in phab:T16779 Tim Starling wrote six years ago: I don't see the need to take MediaWiki apart and put it back together again when you could just fix your broken #ifexist calls. Therefore I guess this is working as designed, you are not supposed to use minimally (PAGENAME) or fully (PAGENAMEE) encoded strings with filepath:. Suggestion, would…
{{filepath: {{#titleparts: {{PAGENAME: File:Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png}} }} }}
//upload.wikimedia.org/wikipedia/mediawiki/3/30/Chameleon_VisualEditor_%27Insert_Media_Dialog%27_Z_Index_Issue.png?utm_source=www.mediawiki.org&utm_campaign=index&utm_content=original
…work for you? The behaviour is documented for #titleparts and here as Warning. Be..anyone (talk) 20:40, 7 April 2016 (UTC)

Substituting PAGEID

The page id can be substituted with {{subst:PAGEID}} when editing an existing page. Can it be substituted when creating a page? GeoffreyT2000 (talk) 00:09, 26 December 2015 (UTC)

No, content is parsed before the new page is created, so it doesn't have page id at this stage. That's similar with REVISION variables. --Ciencia Al Poder (talk) 10:56, 26 December 2015 (UTC)

fullurl now outputs protocol specifier?

{{fullurl:page name}} is described as:

A protocol-relative path to the title. This will also resolve interwiki prefixes. Note: Unbracketed (plain) protocol-relative links are not automagically linked.

But in my MW 1.26 the output is a complete URL including "https:" and is automatically turned into a link!

Is this a new behaviour, or is it specific to my configuration?

--Ahmad Gharbeia أحمد غربية (talk) 11:01, 6 April 2016 (UTC)

I guess you should also have a protocol-relative $wgServer for it to work as described. --Ciencia Al Poder (talk) 19:43, 6 April 2016 (UTC)

Gender magic word

In my opinion Gender magic word should work in Help namespace too. I created a task on Phabricator. --Dvorapa (talk) 15:34, 13 June 2016 (UTC)

__NOGALLERY__ question, feature request

This tag is used in wikipedia mainly to avoid copyright problems in image categories, but unfortunately it makes it difficult to check which images need improvement. My question: is there a way to override the __NOGALLERY__ tag without removing it? If not, would it be possible to add such a feature? (e.g.- append "ignoreNogallery" to the url, or something similar). Thank you --Benstown (talk) 04:27, 31 August 2016 (UTC)

DISPLAYTITLE Example

While not clear from the current Help page description, DISPLAYTITLE may be used to creatively format page titles with <span> tag style. One example of this is hiding the namespace and base page name for subpages. The following code displays subpage name only.

{{DISPLAYTITLE:<span style="font-size:0">{{NAMESPACE}}:{{BASEPAGENAME}}/</span>{{SUBPAGENAME}}}}

Dave Braunschweig (talk) 13:58, 15 September 2016 (UTC)

Add magic word like REVISIONDATE

Whilst creating a content page i am missing the possiblity to create a simple revision date. The method i am using now is as follows: {{REVISIONDAY:Wielen}}-{{REVISIONMONTH1:Wielen}}-{{REVISIONYEAR:Wielen}} It would be much easier to have something like {{REVISIONDATE}} in stead — Preceding unsigned comment added by Gharryh (talkcontribs)

You have {{REVISIONTIMESTAMP}} which you can format with {{#time: d-m-Y | {{REVISIONTIMESTAMP}} }} --Ciencia Al Poder (talk) 10:22, 30 December 2016 (UTC)
Your solution wont work,it just shows the timestamp Type Faiverly Faiverly 20161230151037 }}
— Preceding unsigned comment added by Gharryh (talkcontribs)
It pretty much works: 03-02-2026 --Ciencia Al Poder (talk) 16:14, 30 December 2016 (UTC)

How to create dynamic dates (ie: {{CURRENTDAY}} + 1 = Tomorrow's date)

Does anyone know of a way to do this?

MikeDarling (talk) 04:17, 24 February 2017 (UTC)

UPDATE: I found a solution on Wikipedia. {{CURRENTMONTH1}}/{{#expr:1+{{CURRENTDAY}}}}/{{CURRENTYEAR}} produces: 8/10/2026 (which is tomorrow's date based on the server time). There's more that can be done too. See https://en.wikipedia.org/wiki/Wikipedia:Date_math for more info.
MikeDarling (talk) 04:42, 24 February 2017 (UTC)
Your solution has a flaw, because the last day of the month will give a non-existent date. You should get a date as a whole, add 1 day to it and get back the text representation of it. See Help:Extension:ParserFunctions: {{#time: m-d-Y | +1 day }} gives 08-10-2026 --Ciencia Al Poder (talk) 10:47, 24 February 2017 (UTC)
Thanks! I knew there had to be a better way. MikeDarling (talk) 22:09, 27 February 2017 (UTC)

Is the version 1.7 in the Namespaces section correct?

| <code>{{SUBJECTSPACE}}</code> <br /><code>{{ARTICLESPACE}}</code>
| {{SUBJECTSPACE}} <br />{{ARTICLESPACE}}
| Name of the associated content namespace
| {{MW version|version=1.7|compact=y|comment=and after}}
|-
| <code>{{TALKSPACE}}</code>
| {{TALKSPACE}}
| Name of the associated talk namespace
| {{MW version|version=1.7|compact=y|comment=and after}}

Should the version really be 1.7 for these 2 items? — Preceding unsigned comment added by 72.22.12.62 (talkcontribs)

Why not? Here are the release notes for 1.7 that prove it. --Ciencia Al Poder (talk) 20:13, 30 March 2017 (UTC)

Fullurl:page name

Hello.
When I create a template with this magic word - fullurl, it return an error massage. It say there is a mistake in the title. What can be the prublem? Betmidrash (talk) 14:18, 4 May 2017 (UTC)

What is the title and what is your code? Matěj Suchánek (talk) 11:58, 5 May 2017 (UTC)
Hi. What do you mean? The problem is not on the sites of WikiMeda, it's happen in my private wiki. When I use the magic-word: FULLURL in some template, and try to enter the URL, it say that there is a mistake in the title...
Betmidrash (talk) 08:03, 14 May 2017 (UTC)

urlencode:<syntaxhighlight>...</syntaxhighlight>

Hello!

I'm trying to pass a code snippet to a template. The code snippet uses <syntaxhighlight>...</syntaxhighlight>. I would then link to urlencode that code snippet, but urlencode:<syntaxhighlight>...</syntaxhighlight> doesn't work - presumably because syntaxhighlight somehow pulls the text out of the processing flow? Any ideas how this could be achieved? I.e. something like:

Template:ShowCodeMakeUrl

{{{1}}}
myserver?q={{uriencode:{{{1}}} }}

which is called as

{{ShowCodeMakeUrl|<syntaxhighlight>
...
</syntaxhighlight>}}

It works fine in terms of displaying the code, but urlencode doesn't handle the <syntaxhighlight>... Thanks! Bjohas (talk) 13:56, 5 May 2017 (UTC) (Also see: https://www.mediawiki.org/wiki/Extension%20talk%3ASyntaxHighlight/Archive%202017%20%28Flow%29#h-Passing_code_via_GET_param_to_external_site-2017-05-05T13%3A50%3A00.000Z)

  • I did not fully understand your plan.
    • What is a “code snippet” and where is the problem?
  • Yes, your assumption is right: syntaxhighlight pulls the content out of the source text around.
    • The parser will put the stuff between <syntaxhighlight> tags aside and transclude it later into the HTML document.
    • It is not possible to wrap something into <syntaxhighlight> tags first and process the content later. The other way around works.
  • I fail to guess your expectation, is there a link supposed to be clickable, or shall the URL be displayed as code?
    • Note that for security reasons no external server must contribute code, but internal pages only and may be transcluded.
  • As far I read your intention try something like that:
    • Displaying generated URL, simply use nowiki, why coloured syntaxhighlight?
{{#tag:nowiki|{{ShowCodeMakeUrl|...}}}}
  • A clickable link with coloured syntaxhighlight as linktext, got passed a pipe-escaped code snippet, but no line breaks:
  • Template programming of ShowCodeMakeUrl:
[http://example.org?q={{uriencode:{{{1}}}}} {{#tag:syntaxhighlight|{{{1}}}|lang="php"|inline=1}}]
  • Transcluded with:
{{ShowCodeMakeUrl|way[highway][name="6th Avenue"];node(w)->.n1;way[highway][name="West 23rd Street"];node(w)->.n2;node.n1.n2;out meta;}}
Greetings --PerfektesChaos (talk) 03:46, 6 May 2017 (UTC)
I'll try to summarize all requirements we have:
- Source code (actually "Overpass QL" language) is passed to template as a parameter
- Source code is rendered with syntax highlighting, preserving any new line characters
- An additional icon with hyperlink is generated, hyperlink includes source code as URL parameter. All newline characters need to be preserved!
- If you click on the hyperlink, you'll see exactly the same source code as shown on the wiki page.
See this page with the template in action: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example
Bjohas wanted to find out some way to get rid of the sometimes insane escaping, like ({{((}}bbox{{))}}) instead of ({{bbox}}). This would have the advantage, that a user can just copy & paste some source code as a template parameter and doesn't have to bother with escaping.
For even more details: see https://github.com/tyrasd/overpass-turbo/issues/288
Mmd-osm (talk) 06:51, 6 May 2017 (UTC)
Template:OverpassTurboExample is already using the means I suggested above.
  • Note: source is called syntaxhighlight today.
  • Therefore, {{#tag:source|{{{query}}}|lang=c is already present like I proposed {{#tag:syntaxhighlight|{{{1}}}|lang= above.
  • Template programming functionality is as best as possible yet.
Your real problem is easy escaping of {{bbox}} since those curly brackets are colliding with Wiki syntax.
  • The solution is quite easy:
{{OverpassTurboExample|query=<nowiki>node["amenity"="post_box"]({{bbox}});</nowiki>}}
  • The enclosing nowiki-tags when providing the query= parameter will be stripped off before their content is passed as {{{query}}} inside the programming.
  • However, they will prevent {{bbox}} getting evaluated too early. It is intended that this should happen in advance usually. When returning, their remainders won’t get expanded any longer.
  • Should work. Enjoy.
  • Entire code should be able to be wrapped this way without touching anything inside.
The basic idea when this thread has been opened was fine: enclosing the program code into something to prevent from evaluation.
  • However, syntaxhighlight is a very powerful thing that does a lot of analysis and produces sophisticated output with error messages and highlighting. That is parked outside the wikitext and merged later when the HTML document is composed.
  • 15 years old nowiki has the same disabling effect, but on low level, just hiding its content once from parsing, and bye.
Greetings --PerfektesChaos (talk) 17:01, 6 May 2017 (UTC)
Thanks a lot for the detailed feedback! We have tried the nowiki approach before. Unfortunately, it has one major shortcoming: the source code is no longer passed on to the URL parameter: https://wiki.openstreetmap.org/wiki/User:Mmd/TurboExample - so our initial requirement If you click on the hyperlink, you'll see exactly the same source code as shown on the wiki page. is no longer fulfilled using this approach. Not sure if there's some way to get around this limitation? Mmd-osm (talk) 07:29, 7 May 2017 (UTC)
  • Sorry, my approach has the same pitfall like syntaxhighlight, since nowiki also gets some kind of escaping and is not available for a parser function. I never noticed that yet.
  • Then, the only way to relieve your burden a bit is as follows:
    • Create an auxilary template:bracketed (or any other name).
    • Implement that as follows:
      <onlyinclude>{{<nowiki />{{{1}}}<nowiki />}}</onlyinclude>
    • Transclude
{{OverpassTurboExample|query=node["amenity"="post_box"]({{bracketed|bbox}});}}
  • At least slightly more readable.
  • The last remainig syntax with no extra template would be:
{{OverpassTurboExample|query=node["amenity"="post_box"]({<nowiki />{bbox}<nowiki />});}}

Good luck --PerfektesChaos (talk) 15:02, 7 May 2017 (UTC)

Many thanks for the suggestions - that's helpful! The developer of https://github.com/tyrasd/overpass-turbo has included an 'escaping mechanism' that essentially does this https://github.com/bjohas/mediawikiencode. Many thanks. Bjohas (talk) 10:43, 8 May 2017 (UTC)

On the letter-case of Variables

Hi, I'm recently working on a parser on wikitext, and have read this page so that I can decide whether a "transclusion" is actually a variable or parser function.

Variables, per definition, are uppercase words surrounded by double braces, so {{PAGENAME}}, {{SERVERNAME}} are variables. On the contrary, I believe, parser functions (esp. those starting with #) are case-insensitive.

However, some "variables" are suprisingly case-insensitive, for example, {{sErverName}} will still be parsed to www.mediawiki.org; while others, e.g. {{PAGENAME}} are not (e.g. Template:PAgeName). Though I can hard-code a list for these built-in variable and parser function names, I just couldn't figure out why some "variable"s should be case-insensitive, as it's against the definition in Help:Magic words.

Another problem that confuses me: in Help:Magic words, it's said that behavior switches, variables, and parser functions are three kinds of magic words, but in Manual:Magic words, magic words are defined as "… a technique for mapping a variety of wiki text strings to a single ID that is associated with a function. Both variables and parser functions use this technique." I was thinking about a name to indicate either variables or parser functions, while to distinguish from behavior switches, because variables and parser functions share the similar traits (e.g. the first argument is started with colon, not pipe). Now I'm using something like "Magic Template" but not sure whether it's suitable. Any suggestions? Thank you!

--CXuesong (talk) 08:00, 12 May 2017 (UTC)

{{formatnum:}} result doesn't include comma separator in mywiki

The result value of {{formatnum:123456789000}} in Burmese Wikipedia (mywiki) shows as "၁၂၃၄၅၆၇၈၉၀၀၀" without comma separator. To include group separator in mywiki, how should I do?

code result on mywiki expected value
{{formatnum:987654321.654321}} ၉၈၇၆၅၄၃၂၁.၆၅၄၃၂၁ ၉၈၇,၆၅၄,၃၂၁.၆၅၄၃၂၁
{{formatnum:၁၂၃၄၅၆၇၈၉၀၀၀}} ၁၂၃၄၅၆၇၈၉၀၀၀ ၁၂၃,၄၅၆,၇၈၉,၀၀၀

NinjaStrikers «» 03:51, 6 July 2017 (UTC)

I've been digging in the code and I can't find why it's not formatting it correctly. languages/messages/MessagesMy.php looks correct. API request for easy testing. I suggest you to open a task for this --Ciencia Al Poder (talk) 09:49, 6 July 2017 (UTC)

Username

Is there anything that can detect a character's username? For example, if your name was UserGuy1, the code {{USERNAME}} or something similar would become UserGuy1. Is there anything that can do this? 96.48.149.66 07:25, 29 July 2017 (UTC)

You may try Extension:GetUserName but I'm not sure if this extension will work in current versions of MediaWiki and it also breaks caching. --Ciencia Al Poder (talk) 15:34, 30 July 2017 (UTC)

{{NUMBEROFPAGES}}: bug

On pl wiki and (probably) some others {{NUMBEROFPAGES}} doesn't count new pages, but counts deleted pages. Sławek Borewicz (talk) 19:45, 20 February 2018 (UTC)

I can confirm half of what you are reporting. There's been a lot of page creation and deletion lately on plwiki, so I was able to monitor the statistics (more or less) "live" as pages were created and deleted. What I saw is this:
  1. the page count decreased when pages were deleted (and, as far as I could tell, it seemed to be decreasing by the correct amount each time),
  2. the article count decreased only sometimes when pages were deleted (which would be expected if some deleted pages counted as articles and some didn't),
  3. the article count increased but the page count did not change when an article (with links) was created, and
  4. the page count did not increase when a new page was created outside of the main namespace.
The last two things do seem to be a bug and not just due to lag. I watched for more than 25 minutes and never saw the page count go up despite multiple page creations in that time. I guess this deserves a Phabricator task (i.e., bug report). - dcljr (talk) 21:17, 20 February 2018 (UTC)
Turns out, this was a known bug that has been fixed. Camping out at pl:Special:RecentChanges and pl:Special:Statistics for a while, I was able to verify that page creation is now increasing the page count. - dcljr (talk) 01:07, 22 February 2018 (UTC)
Thx (for the info). Sławek Borewicz (talk) 16:55, 22 February 2018 (UTC)

You forgot equal

You forgot to document {{=}}. (seems to be a template currently, but should be a magic word)

Two hours and a headache. Alexis Jazz (talk) 10:21, 23 July 2018 (UTC)

No, it’s not forgotten. This page documents things that are magic words, not those that should be. {{= }} is not a magic word. You can propose it to became one on Phabricator, and, if implemented, it will be documented here. —Tacsipacsi (talk) 12:55, 23 July 2018 (UTC)

Templates, not magic words

Some variables listed, such as {{ROOTPAGENAME}}, are templates, and not magic words.TheConqueror4712 (talk) 00:55, 8 October 2018 (UTC)

I don’t think so. It’s used on this page, but Help:Magic words doesn’t appear on Special:WhatLinksHere/Template:ROOTPAGENAME. Looks like StructuredDiscussions thinks MediaWiki doesn’t support it, but it does. —Tacsipacsi (talk) 07:19, 8 October 2018 (UTC)

JS to make "wgRevisionId" a magic word

Hi,

I'm using Extension:Approved Revisions [1] and I have a need to be able to display the revision ID of the page revision currently being viewed. From the MW Manual page on Javascript [2] I see that the variable "wgRevisionId" contains this information and is exposed to mediawiki for use, but it is not clear to me how to do so. I would like to create a magic word [3] called Template:VIEWEDREVID that outputs the revision ID of the revision being viewed such that it can be used in other parser logic

For example:

{{#ifexpr:( {{VIEWEDREVID}} < {{APPROVEDREVID}} )
|if true
|if false
}}

Can someone please help me identify the way to make a magic word that contains the value of "wgRevisionId"?

Thank you! -Rich User:revansx

[1] https://www.mediawiki.org/wiki/Extension:Approved_Revs

[2] https://www.mediawiki.org/wiki/Manual:Interface/JavaScript

[3] https://www.mediawiki.org/wiki/Help:Magic_words


Let's concentrate all discussions in one place: Extension talk:Approved Revs#Help making "wgRevisionId" a magic word --Ciencia Al Poder (talk) 09:09, 25 October 2018 (UTC)

CURRENTWEEK/YEAR when 31 Dec is on a Monday

Hello from Monday, 31 Dec 2018, where CURRENTWEEK returns 1 and CURRENTYEAR returns 2018, resulting in nonsense when used together. I'm guessing that CURRENTWEEK is handled like ISO week dates but CURRENTYEAR is Gregorian, resulting in weird behavior on this edge case. -PFWOz (talk) 19:02, 31 December 2018 (UTC)

Dug through some 10-year-old bug tickets and the workaround is to use {{#time}}. T18838:
Use {{#time:o/W}} combination instead of {{#time:Y/W}} or {{CURRENTYEAR}}/{{CURRENTWEEK}}.
This should be made much clearer in the documentation, which suggests {{#time}} for more thorough time formatting, but not for improved correctness. Some details on how these magic words are calculated would help when trying to determine whether that's actually necessary. -PFWOz (talk) 19:07, 31 December 2018 (UTC)

False example for PAGENAME encoding of apostrophe

Help:Magic words#Page names shows an example which is currently false:

Warning Warning: For example, if page name is "L'Aquila", the following code will produce the string "Numeric char encoding":
{{#switch:{{PAGENAME}}
| L'Aquila = No translation
| L = Not OK
| L&apos;Aquila = Entity escaping
| L&#39;Aquila = Numeric char encoding
}}

The code actually produces "No translation". Numeric char encoding to &#39; does happen but #switch (same with #ifeq) will match &#39; to any of ' (a pure apostrophe), &apos; and &#39;. The first match in the switch is chosen. "Show changes" on {{subst:PAGENAME:L'Aquila}} will show that {{PAGENAME}} produces L&#39;Aquila if page name is "L'Aquila". It can cause problems in other situations. PrimeHunter (talk) 12:33, 12 January 2019 (UTC)

It is a wiki...

Anyway, when it was written it was 100% right, but things in the parser have changed since then, which is easy enough to prove by installing an older mediawiki version, or finding a public wiki, e.g. on wikia's wikis it shows "L'Aquila". The only way to keep the example always true is to make it dynamic by identifying a parser function or lua function that will always match its behaviour, and transcluding that.

The rest of the comment is rather irrelevant, as far as the misguided "switch" parser function is concerned. It mostly follows the rules of programming languages, if multiple values match then it picks the first one, and that's clearly documented even for non-programmers.

Also, the warning comes with bug reports, so if any of them gets fixed it affects the example. So technically it isn't false.

197.218.85.83 11:07, 13 January 2019 (UTC)

Other magic words

Where can I find magic words such as {{GENDER}} and {{SHORTDESC}}? CaiusSPQR (talk) 01:31, 23 January 2019 (UTC)

These are included with Extension:Wikibase. Took me a couple hours to figure out {{SHORTDESC}}, but it seems you need to add $wgWBClientSettings['allowLocalShortDesc'] = true; to your localsettings.php after setting up Wikibase. This does add "shortdesc" to the list of parser function hooks in Special:Version, but I have yet to see it actually work as {{SHORTDESC:}}, is still recognized as a template on my own wiki for some reason. Somebody should really document this properly somewhere. - ElementalLagomorph (talk) 22:52, 29 January 2019 (AEDT)

Get number of subpages of a mainpage

I have a page with multiple subpages attached to it. Is it possible to get the count of subpages and display that information? Extarys (talk) 05:06, 19 February 2019 (UTC)

I don’t know of any core function, but I should be possible using an extension (I don’t know whether such extension exists currently). —Tacsipacsi (talk) 18:22, 19 February 2019 (UTC)

{{DEFAULTSORT:}}

Does an empty defaultsort make sense or can it be deleted? I found it on may pages in Commons[4]. --Aschroet (talk) 05:07, 5 April 2019 (UTC)

You see that with empty argument it has no effect – instances on Commons likely resulted from a malfunctioning bot. This behaviour certainly should be documented. Incnis Mrsi (talk) 11:56, 7 April 2019 (UTC)

Behavioral switches -> directives?

Does behavioral switches shouldn't be named directives? They seem similar. MarMi wiki (talk) 19:36, 13 June 2019 (UTC)

Help:Magic_words#Localization - plural description should be more descriptive

@Shirayuki: - I think that plural description should be more descriptive:

  • Is Form 1 a singular form of plural (then some more examples would be handy), or it's just a singular (only 1 single item)?
  • Is it only for words like is/are, or it's for singular (form 1, number 1)/paucal (form 2 or 3, numbers ending with digit 2-4)/plural (form 2 or 3, numbers ending with digit 0-1 [without number 1] and 5-9) forms of nuons (like Russian example may suggest [don't know Cyrillic/Russian that well])? (Numbers are for Poland).
  • Form 1 has numbers 1, 21, 31,... What about 11?
  • Does it even work on non-english sites? From my tests (based on is/are examples) it seems that it doesn't ({{plural:5|is|are}} should return empty value, but it doesn't). Okay, it works on Russian wikipedia, but in strange way: {{plural:5|is|are}} returns are, {{plural:5|is|are|third}} returns third. Shouldn't first return empty value?

MarMi wiki (talk) 00:11, 14 June 2019 (UTC)

As I wrote in edit summary, the description came from translatewiki:Thread:Portal_talk:Ru/Plural_changes_in_many_languages, so "21, 31, ..." should NOT be removed. It is written about some languages (ab, av, ba, etc.).
For example, English ordinal numbers have similar rule. 1st, 11th, 21st, 31st, etc. -Shirayuki (talk) 11:57, 14 June 2019 (UTC)
But what if it's not an ordinal number? Then it will work wrongly (in Polish): 1 szablon (template), 11 szablonów (templates), 21 szablonów (templates), 31 szablonów (templates), etc. Unless it's meant only for ordinal numbers (then there should be two magic words: ordinal and plural)? MarMi wiki (talk) 12:12, 14 June 2019 (UTC)
I think that plural description needs to specify if it's only for general broad singular/plural differentiation (jeden szablon/one template, wiele szablonów/many templates) or more detailed singular/plural differentiation based on numbers (1 szablon/template, 2 szablony/templates, ..., 4 szablony/templates, 5 szablonów/templates, ..., 9 szablonów/templates, etc.). MarMi wiki (talk) 13:10, 14 June 2019 (UTC)
Maybe someone knows where I can see couple of uses of this magic word in actual action? It would help to determine if it's fine as it is, or it needs some changes for my language.
Another note: is it choosing the mode depending on parameter count? Ex. 3 parameters (number + 2 words) - English (general broad) mode, 4 - Russian (more detailed) mode?. MarMi wiki (talk) 13:59, 14 June 2019 (UTC)

Summary of magic word plural after some tests:

  • It's for simple one/many differentiation (English mode) AND for singular (form 1, number 1)/paucal (form 2 or 3, numbers ending with digit 2-4)/plural (form 2 or 3, numbers ending with digit 0-1 [without number 1] and 5-9) forms of nuons (given numbers may be wrong depending on given word) ("Russian" mode)
  • It works on Polish wikipedia (but numbers given in documentation for Form 1/2/3 doesn't match - they should be translatable too)
  • Used mode depends on number of parameters: number + 2 parameters (words) - simple English mode, with number + 3 parameters - advanced "Russian" (adapted to Polish) mode. MarMi wiki (talk) 14:49, 14 June 2019 (UTC)

And I think Russian example needs to be updated - it doesn't match the order of numbers in Form 1/2/3. Russian example is correct - form 2 is in the third parameter (not counting the first number), and form 3 is in the second. Form order doesn't match the parameter order, which may be a little confusing. MarMi wiki (talk) 15:48, 14 June 2019 (UTC)

Moved the Russian special rule into Note template. It is not about English, Polish, and Japanese. -Shirayuki (talk) 02:29, 15 June 2019 (UTC)

@Shirayuki: I find it confusing too. Form 1, form 2 and form 3 are supposed as {{PLURAL:$1|form 1|form 2|form 3}}. The note box for Slavic languages has a link to Translatewiki explaining that form 2 and form 3 were interchanged in 2014, but when I try it w:ru:Special:Permalink/103697654 they work in the previous order. Have I missed anything? --Vriullop (talk) 10:42, 5 December 2019 (UTC)

I think I found an explanation. The three forms are usually referred in papers as singular (1st form in nominative singular), plural (2nd form in genitive plural) and paucal (3th form in genitive singular). The paucal form is usually the last one as it is less common. But the parser function uses another order {{PLURAL:$1|singular|paucal|plural}} that is not properly documented, it can only be deduced from the examples in Russian by native speakers. --Vriullop (talk) 11:49, 6 December 2019 (UTC)

Template name

Is there a magic word similar to {{PAGENAME}} that doesn't change when it's transcluded as a template? For example, say this magic word was called {{TEMPLATENAME}}. If I created a template called {{Title}}, containing something like "This template is called {{TEMPLATENAME}}", it would transclude as "This template is called Title". I can't use {{PAGENAME}} for this, because it automatically changes to the page title. Gfdgsgxgzgdrc (talk) 00:31, 16 June 2019 (UTC)

@Gfdgsgxgzgdrc: I don’t know of any, but why would it be useful? {{PAGENAME}} is useful because the template can query the name of the page it’s used in—the template’s creator doesn’t know where the template will used. But the title of the template you’re just editing is known to you, so you can simply hardcode it. —Tacsipacsi (talk) 23:27, 16 June 2019 (UTC)
You can put {{subst:PAGENAME}}, that will be substituted on page save. --Ciencia Al Poder (talk) 09:35, 17 June 2019 (UTC)

SUBPAGENAME : PAGENAME should be replaced by BASEPAGENAME for assertion to be coherent with display

Hi all, In paragraph https://www.mediawiki.org/wiki/Help:Magic_words#Page_names we use PAGENAME . On the FR translated page I get:

SUBPAGENAME fr Titre de la sous-page ("bar" pour "Aide:Titre/foo/bar"). Si aucune sous-page n'existe, la valeur de {{PAGENAME}} est renvoyée.

If I look at PAGENAME I read 'Magic words/fr' which is not coherent since I expect only 'Magic words' (as for EN pages).

Then Translations:Help:Magic words/125/fr should be:

SUBPAGENAME 	fr 	Titre de la sous-page ("bar" pour "Aide:Titre/foo/bar"). Si aucune sous-page n'existe, la valeur de  {{BASEPAGENAME}}  est renvoyée.

=> Can anyone substitue the value of $code please using BASEPAGENAME instead of PAGENAME  ?

FR version displays:

PAGENAME 	Magic words/fr 	Titre complet de la page (incluant tous les niveaux des sous-pages) sans l'espace de noms.

BASEPAGENAME 	Magic words 	Titre de la sous-page de niveau immédiatement supérieur sans l'espace de nom ("Titre/foo pour "Aide:Titre/foo/bar")...

SUBPAGENAME fr Titre de la sous-page ("bar" pour "Aide:Titre/foo/bar"). Si aucune sous-page n'existe, la valeur de {{PAGENAME}} est renvoyée.

Thanks.

Christian Wia (talk) 09:07, 5 July 2019 (UTC)

I personally think the current situation is fine, and even more illustrative than then english page, since you can actually have different values for SUBPAGENAME, BASEPAGENAME, etc. --Ciencia Al Poder (talk) 10:49, 8 July 2019 (UTC)

page is in category X

I'm searching for a magic word or a function that can tell if a page or file is in a specific category. I have not found anything so far. --D-Kuru (talk) 10:36, 25 August 2019 (UTC)

@D-Kuru: This is because it could have unpredictable results in edge cases. Let’s say we have a such function named #ifincat. What should the below code produce on the page “Page”?
{{#ifincat:Page|Category|<!-- do nothing -->|[[Category:Category]]}}
If the page is in the category, the function returns nothing, so the page doesn’t get placed in the category, so the function returns the code placing it in the category, so it’s in the category, so it doesn’t get placed in it… —Tacsipacsi (talk) 15:06, 25 August 2019 (UTC)
@Tacsipacsi: Thanks for the fast reply!
I don't think that you need a specific output on the page itself (unlike eg. PAGESINCAT). I would have used just the return value (be it a boolean or a string) as some kind of the opposite of a template that includes a category. The use in my project would have been to check if file A.jpg is in Category:Hello and Category:Goodbye and if this is the case include a template, a warning, a category or whatever.
Your example would indeed be bad. You could display a warning though, when the function is used like that (like there is for template loops).
--D-Kuru (talk) 15:25, 25 August 2019 (UTC)
This could also be interesting as tool as such.
If you want to improve your photograohy skills and you want to see what images User:B has taken with camera Y and lens Z that are considered Qualiy Images or Fetured Pictures --D-Kuru (talk) 15:52, 25 August 2019 (UTC)
@D-Kuru: Do you want to use this feature on Commons or your own wiki? I don’t think WMF would welcome a such function because of its edge cases, but you can use PetScan for intersecting Commons images (and that requires no template at all on the file description page!). —Tacsipacsi (talk) 17:54, 25 August 2019 (UTC)
@Tacsipacsi: I would use this for a project on Wikimedia Commons. PetScan looks quite nice (even I'm not quite sure how to use it), but I can not include this on a page where I can automatically tag certain images.
I already thought that this is not a very popular function or it would already exist. Because of the lack of knowledge how I could do that myself I have to see if there already is something like that. Short of a function like that existing, I have to manually edit the file description pages - which is actually the kind of manual work I want to avoid with this. --D-Kuru (talk) 19:49, 25 August 2019 (UTC)
@D-Kuru: I don’t know how do you want to use it on Commons, but the template should be on the page to start with, and building it in a widespread template is a big no performance-wise—such templates’ edits may slow down Commons, if only the 0.1% of the files break (e.g. with “too many expensive parser functions” error), that’s tens of thousands of files, and the edit may be visible even in WMF’s electricity bills due to reparsing all 55 million files. And I haven’t thought of it before, but I’m not sure it’s possible at all to access a page’s categories reliably before processing the page entirely, at which point no parser function can do anything. So I think this feature cannot be implemented at all without rewriting MediaWiki, which is hardly a possibility. 🙂 —Tacsipacsi (talk) 21:26, 25 August 2019 (UTC)

Please document SHORTDESC

Please add documentation for SHORTDESC. Thanks. I see a mention of it in T184000, but I don't know where to find official documentation (aside from this page, where it is missing). Jonesey95 (talk) 19:45, 6 October 2019 (UTC)

@Jonesey95: This page documents only MediaWiki core’s magic words, not extensions’ ones. SHORTDESC is provided by Extension:Wikibase Client, so it should be documented there. —Tacsipacsi (talk) 20:47, 6 October 2019 (UTC)

Magic word that checks how many pages a template is on?

Does anyone know how to do this? — Preceding unsigned comment added by Pomegranatecookie (talkcontribs) .

No, there's no magic word for that. You can get rough idea of the number however through Special:WhatLinksHere and using namespace selector. If it's on Wikipedia that you want count this you can use https://tools.wmflabs.org/templatecount/ — Preceding unsigned comment added by Ammarpad (talkcontribs) 21:19, 19 January 2020 (UTC)
If your wiki has CirrusSearch installed, then you can get an exact count by searching with hastemplate:"Template:MYTEMPLATE" and selecting all namespaces. --Bdijkstra (talk) 08:35, 21 January 2020 (UTC)

Querying preprocessor values during page processing

Is it possible for a template or module to query the following values (taken from "view page source" of en:Wikipedia:Template_limits oldid=925577618 a few minutes ago)? If so, how?

Preprocessor visited node count: 613/1000000
Post‐expand include size: 52139/2097152 bytes
Template argument size: 234/2097152 bytes
Highest expansion depth: 10/40
Expensive parser function count: 6/500
Unstrip recursion depth: 0/20
Unstrip post‐expand size: 3942/5000000 bytes
Number of Wikibase entities loaded: 0/400
Lua time usage: 0.085/10.000 seconds
Lua memory usage: 2.52 MB/50 MB

A "limit-aware" module could, for instance, revert to simpler logic at the expense of functionality if it detected that the page calling it was approaching any of the above limits. Davidwr (talk) 21:37, 25 February 2020 (UTC)

New magic word?

I think the cirrus search function filemime: is really neat. I have not seen it as a magic word however. Have I missed something? If not, where can you suggest new magic words? Honestly I think all cirrus search functions filemime:, filetype:, incategory:, hastemplate:, etc. should have a magic word pair, if they already do not.Jonteemil (talk) 00:20, 14 March 2020 (UTC)

MIME is accessible from Lua, see Extension:Scribunto/Lua reference manual#File metadata. Lua can generally access more things, so I’m not sure if it will ever be added directly to wikitext. —Tacsipacsi (talk) 00:25, 14 March 2020 (UTC)
@Tacsipacsi: Okay, thanks. What would I write at c:File:Flag of Sweden to output image/svg+xml?Jonteemil (talk) 16:32, 14 March 2020 (UTC)
Okay, I found it at c:Module:File, thanks!Jonteemil (talk) 16:58, 14 March 2020 (UTC)

Avoid section numbering for just one page

In my preferences I have included to show section numbers. But on some pages (e.g. multi-column) this is disturbing the layout. Could there possibly exist a __NOSECTNUM__ construct to overrule the preferences setting for one single page? Geertivp (talk) 13:43, 12 April 2020 (UTC)

What preference is it? Does it come from an extension or is it a gadget? For single-page customizations, TemplateStyles would work. --Matěj Suchánek (talk) 09:17, 13 April 2020 (UTC)
It is a plain MediaWiki (global/local) setting:
Preferences -> Appearance -> Advanced options -> Auto-number headings -> Enable/disable
@Matěj Suchánek: Thanks for your Extension:TemplateStyles hint.
I implemented your recommendations -- it worked like a gem -- see: wmbe:Wikimedia Belgium and wmbe:Template:CSS/Nosectnum.css - Geertivp (talk) 12:27, 13 April 2020 (UTC)

Brackets

Is there a PAGENAME variant which removes brackets?--Launchballer (talk) 23:36, 1 June 2020 (UTC)

Most brackets are already not allowed in Page title, I think only round brackets are. It would be easier to give you better answer if you explain exactly what you want achieve. Ammarpad (talk) 07:44, 27 July 2020 (UTC)
enwiki and other wikis use w:Template:PAGENAMEBASE (custom template, not a magic word, don't confuse with BASEPAGENAME). Matěj Suchánek (talk) 09:31, 27 July 2020 (UTC)

Could {{FULLURL:}} be modified to take more than one parameter?

All the url functions seem to only take one parameter. Is there any way of having more, whilst still using magic words? User:WT79 (please use my enwiki talk page) 14:58, 26 July 2020 (UTC) (I am not watching this page, so please ping me if you want my attention.)

@WT79: The query_string is not constrained to only one parameter. So you can build a complex query with many parameters. Example using four paramaters, {{fullurl:en:Wikipedia:Sandbox|oldid=969629111&action=edit&section=1&safemode=1}} gives: https://en.wikipedia.org/wiki/Wikipedia:Sandbox?oldid=969629111&action=edit&section=1&safemode=1 Ammarpad (talk) 07:39, 27 July 2020 (UTC)
@Ammarpad: Thanks; din't think of using &s in the parameter. User:WT79 (please use my enwiki talk page) 08:07, 27 July 2020 (UTC)

PAGENAME vs. #invoke:WLink|getArticleBase

Hi,

please can anyone tell me is there any difference between {{PAGENAME}} and the LUA-Module {{#invoke:WLink|getArticleBase}}? I can't spot it and I can't find anything about a comparison via Google/Bing, too.

Thanks! — Preceding unsigned comment added by Semmelrocks (talkcontribs) 22:11, 2 November 2020 (UTC)

{{#invoke:WLink|getArticleBase}} removes text in parentheses from the page name, whereas the {{PAGENAME}} doesn't. For example, you can see from de:Wikipedia:Lua/Modul/WLink/Test#getArticleBase that {{#invoke:WLink|getArticleBase|WLink (library)}} produces WLink, but {{PAGENAME:WLink (library)}} produces WLink (library) * Pppery * it has begun 22:50, 2 November 2020 (UTC)
@Pppery Thanks a lot!--Semmelrocks (talk) 15:30, 3 November 2020 (UTC)

Is there some equivalent of {{CURRENTUSER}}? The functionalities I'm looking for are:

  • Is the current user viewing this page logged in?
  • What is the username of the current current user viewing this page?

Are there any magic words or equivalent that can return this in wikimarkup? T.Shafee(Evo﹠Evo)talk 06:47, 13 December 2020 (UTC)

There was once an Extension:USERNAME but it has been archived and nobody uses it, because it's not compatible with caching. --Ciencia Al Poder (talk) 10:28, 14 December 2020 (UTC)
MediaWiki:Group-user.css can be used to specify styles that apply only for logged-in users. You can define e.g. a .noanon and an .anononly class, hide .noanon in MediaWiki:Common.css, and hide .anononly and forcibly show .noanon in Group-user.css. This is quite limited, as it can only affect the end result, you can’t compute further depending on the logged-in state, and probably it doesn’t work on mobile, but at least it exists. Depending on your precise requirements, it may or may not be useful. —Tacsipacsi (talk) 19:50, 18 December 2020 (UTC)

Formatnum outputs extraneous spacing

When {{Formatnum }}, or any wrapper template, receives a non-numeric argument, the page is correctly added to Category:Pages with non-numeric formatnum arguments. However, I noticed that the template also outputs what appears to be a newline at the end of the text. This does not show or pose any problems for rendered articles but appears as extraneous spacing when using the Visual Editor. Check my sandbox (in Visual Editor mode) as an example. Inexperienced users who see this often try to "fix" what looks like a double-space by removing the actual space that follows the template use. Can this be fixed? I could not immediately find the source code for the magic word, if it is even viewable publicly. Regards, IceWelder (talk) 20:09, 9 March 2021 (UTC)

Hello @IceWelder: . It looks like you're using the commas on a magic word. We recommend you to remove that. It is automatically adding commas. For the 4. option, it is not a good idea to put there in a "million" word in formatnum. Exclude the word from the "million" word, so that category will be removed. Thanks. —Baran ☪︎ 03:37, 10 March 2021 (UTC)
@Baris6161TURK: I am aware that the usage is technically incorrect. However, such errors appear numerously on enwiki, and the large majority of users who see the aforementioned double-space would not know how to fix it properly. As I see it, this problem needs fixing on both sides: Correction of the magic word output to stop the issue from occurring to new users, and cleanup of the template arguments on enwiki to correct the template usage. IceWelder (talk) 09:02, 10 March 2021 (UTC)
The code responsible for noticing non-numeric input and marking it as such is here, but I have no clue why this space appears. Maybe it’s a bug in VisualEditor/Parsoid rather than in the parser function. —Tacsipacsi (talk) 15:02, 10 March 2021 (UTC)
It might be a bug in Parsoid depending on how it processes the template output. For example, the generated HTML for a proper out looks like this:
<p id="mwBQ" class="ve-ce-branchNode ve-ce-contentBranchNode ve-ce-paragraphNode">||<span about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;formatnum:22.0&quot;,&quot;function&quot;:&quot;formatnum&quot;},&quot;params&quot;:{},&quot;i&quot;:0}}]}" id="mwBg" class="ve-ce-leafNode ve-ce-focusableNode ve-ce-mwTransclusionNode ve-ce-focusableNode-focused" contenteditable="false">22.0</span>||</p>
While the improper one looks like this:
<p id="mwCA" class="ve-ce-branchNode ve-ce-contentBranchNode ve-ce-paragraphNode">||<span about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;formatnum:22,000,000&quot;,&quot;function&quot;:&quot;formatnum&quot;},&quot;params&quot;:{},&quot;i&quot;:0}}]}" id="mwCQ" class="ve-ce-leafNode ve-ce-focusableNode ve-ce-mwTransclusionNode" contenteditable="false">22,000,000
</span><link rel="mw:PageProp/Category" href="https://en.wikipedia.org/wiki/Category:Pages_with_non-numeric_formatnum_arguments" about="#mwt3" id="mwCg" class="ve-ce-leafNode ve-ce-focusableNode ve-ce-mwTransclusionNode" contenteditable="false">||</p>
Notice the linebreak after "22,000,000" that is still within the span tag. I see the code for Parsoid is located on GitHub but I wouldn't know where to start looking for something like this. Maybe we can get a Parsoid dev (@Arlolra?) to also check on this? IceWelder (talk) 22:23, 11 March 2021 (UTC)
You can also file a bugreport to the relevant project --Ciencia Al Poder (talk) 15:41, 12 March 2021 (UTC)
Since we haven't identified the exact cause yet, I wouldn't know where to file the bug report. IceWelder (talk) 16:58, 15 March 2021 (UTC)
The source of the newline is here. It comes from this commit introduced for T72196. If it's causing a problem, a task should be filed against Parsoid. Thanks Arlolra (talk)
I filed T277760 for this Arlolra (talk)
@Arlolra: Thank you very much! Does the mobile app also use Parsoid or is that a separate bug? IceWelder (talk) 14:48, 18 March 2021 (UTC)
Same bug, the mobile apps use Parsoid's output. Arlolra (talk) 14:55, 18 March 2021 (UTC)
What does the wikitext look like here? It seems perhaps the extra space is being added between the output of formatnum and the category tag, when the "pages with non-numeric formatnum arguments" category has to be added? cscott (talk) 20:23, 15 March 2021 (UTC)
@Cscott: In the VE, it renders as:
||22||
||22.0||
||22,000,000 ||
||22 million ||
The spacing between the numbers and the trailing pipes in the latter two should not be present. You can also still check my enwiki sandbox in VE to replicate it. IceWelder (talk) 12:50, 16 March 2021 (UTC)
Slight update: A user reported that they also encountered this behaviour through the iOS Wikipedia app. I thus downloaded the Android app and I could reproduce the error there. Either the VE and the mobile apps make the same mistake or the error really does lie within formatnum itself. IceWelder (talk) 08:07, 17 March 2021 (UTC)
Ok, this should be fixed now Parsoid/Deployments#July 13-15: V0.14.0-a7 as part of 1.37.0-wmf14
You might need to ?action=purge a page to clear the cached result though Arlolra (talk) 15:59, 16 July 2021 (UTC)

NUMBEROFCATEGORIES

How can I assure that DEFAULTSORT really sorts as expected?

On my wikis, I intensely use DEFAULTSORT for articles about persons. But every now and then I see that they aren't properly sorted in their assigned categories. New articles or those with edited DEFAULTSORT keys are sometimes inserted at the end of a Character list on the relevant Category pages, like you may be able to see e.g. here on my wiki. What am I doing wrong or is there any script or bot to resort articles according to their default sorting? (I'm not talking about proper sorting of e.g. German umlauts.) --Ulf Dunkel (talk) 10:56, 17 April 2021 (UTC)

What specific pages look wrong sorted? From a quick look I only see those: Hannes Moser and Moses Maimonides, but both are correct according to the DEFAULTSORT magic word. --Ciencia Al Poder (talk) 13:05, 17 April 2021 (UTC)
Please take a look at the Category:Male on my wiki once more. In almost every letter section, there are newer articles listed which are not sorted correctly. In A e.g., you will find Mikael Aktor and Simon Almkor sorted behind Bertrand Auvert. In B, you will find Gary Burlingame before Zachary Levi Balakoff, Felix lter (DEFAULTSORT here: "Boelter, Felix"), Shmuley Boteach, and Jordan Michael Bresson. It seems as if new articles or those with updated DEFAULTSORT values are sorted behind the last fitting entry for the alphanumerical sorting. So if there is a Balakoff behind Burlingame for any reason, the sorting mechanism drops the newer articles Bölter, Boteach and Bresson behind Balakoff, not between upper entries of the B section.--Ulf Dunkel (talk) 13:22, 17 September 2021 (UTC)
That's odd and reminds me of some problems I'm having, though maybe in your case, it's a job queue that's not been resolved or certain jobs have been aborted. See https://www.mediawiki.org/wiki/Manual:Job_queue. Cavila 14:19, 17 September 2021 (UTC)
Thank you for hinting me to cron jobs, but I haven't installed any which didn't come with the normal MediaWiki installation. It seems as if the sortKey is only computed after the page source has been changed. I tried this with various articles and saw that it adds a table entry page_props.pp_propname = "defaultsort" to the database. But that doesn't resort the pages properly. I also wonder why the parameter page_props.pp_sortkey is NULL in all rows. I have no idea how to fix this sorting issue.--Ulf Dunkel (talk) 14:56, 17 September 2021 (UTC)
@Ulf Dunkel: As long as page_props.pp_value is non-empty, this table should be okay. Perhaps Manual:$wgCategoryCollation and Manual:updateCollation.php can help you. --Matěj Suchánek (talk) 08:12, 11 October 2021 (UTC)

Possible typo: "character and phase"

[5], shouldn't this be "character and phrase"? MarMi wiki (talk) 15:22, 4 June 2021 (UTC)

I removed the dubious "character and phase". Feel free to re-add if this indeed was correct. Taylor 49 (talk) 15:05, 17 March 2024 (UTC)

Collapsible TOC

Is there an equivalent to the __TOC__ magic word that will produce a collapsible table of contents, e.g. in the same manner as the {{Collapse top}} template but a magic word and for TOCs only? –Tommy Kronkvist (talk), 15:07, 23 June 2021 (UTC).

@Tommy Kronkvist: Tables of contents are always collapsible, at least using the default Vector skin. Whether they’re initially collapsed or not depends on user preferences (even for logged-out users) and you can’t control it, although you can wrap it in an initially collapsed outer box so that it’s collapsed for all users on page load, see e.g. m:Template:TOC hidden. (It’s not a magic word, though.) —Tacsipacsi (talk) 15:16, 23 June 2021 (UTC)
@Tacsipacsi: Thanks: guess I have to have a look in my Vector skin- and related preference settings. Thanks for the link as well. –Tommy Kronkvist (talk), 15:22, 23 June 2021 (UTC).

Self-closing tag

It is possible to generate a self-closing tag? For example, <ref name="Einstein1905" />

Currently, when I enter null content, the separate closing is added:

  • {{#tag:ref||name=Einstein1905}}<ref name="Einstein1905"></ref>

The code functions as expected BTW, not a bug. -DePiep (talk) 19:16, 28 June 2021 (UTC)

I wonder why you think the code works fine? When I try your example, it drops an error: "Cite error: Invalid <ref> tag; no text was provided for refs named Einstein1905".--Ulf Dunkel (talk) 13:22, 17 September 2021 (UTC)
Of course it won’t work on its own, you need to define the content somewhere. For example:
Lorem ipsum{{#tag:ref||name=Einstein1905}} dolor sit amet.{{#tag:ref|{{Cite journal|last=Einstein|first=A.|date=1905|title=Zur Elektrodynamik bewegter Körper|journal=Annalen der Physik|volume=17|pages=891–921}}|name=Einstein1905}}
correctly renders as
Lorem ipsum[1] dolor sit amet.[1]
Tacsipacsi (talk) 22:05, 17 September 2021 (UTC)

References

  1. 1.0 1.1 Einstein, A. (1905). "Zur Elektrodynamik bewegter Körper". Annalen der Physik 17: 891–921. 

{{#language:xx|zgh}}

{{#language:ary|zgh}} gives Moroccan Arabic instead of ⵜⴰⵄⵕⴰⴱⵜ ⵜⴰⵎⵖⵔⵉⴱⵉⵜ, and {{#language:he|zgh}} gives Hebrew instead of ⵜⴰⵄⵉⴱⵔⵉⵜ, same thing for some other language names are untranslated or translated incorrectly. How can this be fixed? And where?--Brahim-essaidi (talk) 21:46, 2 October 2021 (UTC)

Where is the right place to put {{noexternallanglinks}} in this manual? (more info: Wikibase/Installation/Advanced_configuration#noexternallanglinks) --Valerio Bozzolan (talk) 17:04, 31 October 2021 (UTC)

{{=}}

This looks also like magic word now, document it? Liuxinyu970226 (talk) 10:51, 16 November 2021 (UTC)

When I write =, Template:= shows up on the Templates used in this preview list. So no, it’s not a magic word (at least not on mediawiki.org). —Tacsipacsi (talk) 20:39, 16 November 2021 (UTC)
No, not yet. --Matěj Suchánek (talk) 11:10, 20 November 2021 (UTC)
@User:Matěj Suchánek: Now it is, since year 2022. Please delete Template:=. Taylor 49 (talk) 02:53, 1 December 2024 (UTC)
Template:! also exists, even though it has existed as a magic word for a decade. I think they are still useful for documentation, also they continue to be used on a few pages through redirects (as well as in some Flow posts directly – silly Flow makes the “parser cache” never expire, because it reinvents the wheel as always and doesn’t actually use the parser cache). —Tacsipacsi (talk) 17:35, 1 December 2024 (UTC)
Indeed all Template:! Template:= and Module:No globals should get deleted on all wikis, otherwise the related changes to MediaWiki do not make sence. You want {{=}} to be a parser function in order to get rid of Template:=. If you want to keep "Template:=" together with all its overcomplicated testing, documentation, categorization etc infrastructure anyway, then there is no need to make {{=}} a parser function. Wiki is getting overintricate and unmaitainable. Taylor 49 (talk) 17:28, 3 December 2024 (UTC)
What overcomplicated testing, documentation, categorization etc infrastructure? Neither template has any testing infrastructure, and documentation and categorization uses just the standard infrastructure – {{Documentation }} exists anyway, Category:Workaround templates contains more than just these two templates.
The main gain of these parser functions is that they work out of the box on new and small wikis, not that we can delete two established and still-used templates on an established and large wiki. The wiki won’t get overintricate and unmaitainable by not doing something (if we don’t do anything, things stay as overintricate and unmaintainable as they were, not more), and these templates aren’t intricate or unmaintainable anyway. —Tacsipacsi (talk) 20:12, 4 December 2024 (UTC)
{{=}} is not "used" anywhere at all unless you write {{Template:=}} for some reason such as faking usefulness. And new and small wikis still frequently create Template:! Template:= Module:No globals with the only reason "many wikis have those". About "get overintricate and unmaitainable by not doing something" ... new "features" are being added daily, so "not doing" is ultimately not the current case. And it's more diffucult to find out why something is broken if it can be broken on 100 places, compared with say 20 years ago when there were only two locations to memorize and check. Taylor 49 (talk) 15:48, 7 December 2024 (UTC)
I didn’t state {{=}} is used; I stated Template:= is used. As a redirect target, for example.
For the copying, I don’t think deletion is the best solution. If we delete Template:=, which currently exists on 280 wikis, it’ll exist on 279 wikis – still “many wikis have this”, people will simply copy it from another one. If we instead put a huge warning on it (which has already happened for Template:!, and could happen for Template:= as well), people who try to copy it from mediawiki.org will hopefully stop instead of copying it from somewhere else. —Tacsipacsi (talk) 21:35, 7 December 2024 (UTC)

How to set precision with {{formatnum}}

I see that the {{formatnum}} template was replaced by the {{formatnum}} magic word. With the template I could set the precision of a number, but I don't know how to do it with the magic word.

How do I format a number to limit it to e.g. 2 decimal places?

i.e. 10.11111 -> 10.11

Any help would be appreciated. - 196.10.113.11 08:55, 25 November 2021 (UTC)

{{formatnum:{{#expr: (10.11111) round 2 }}}} → 10.11. --Matěj Suchánek (talk) 09:14, 28 November 2021 (UTC)

List of available options for int?

{{int:lang}} gives me "en". what other things can i put in place of "lang"? where can i find the full list? RZuo (talk) 22:36, 9 April 2022 (UTC)

Any MediaWiki message. This includes the software-defined messages listed on Special:AllMessages (on mediawiki.org, it’s about 27,000 messages) as well as custom messages like lang or cat-browser (see all pages in the MediaWiki namespace; theoretically any message could be included with {{int:}}, but pages like gadgets’ codes make little sense). —Tacsipacsi (talk) 01:11, 10 April 2022 (UTC)

How to access the section number?

This is section number 78 of the talk page, as shown by the url under the link edit source:

https://www.mediawiki.org/w/index.php?title=Help_talk:Magic_words&action=edit&section=78.

Can I get this number via a magic word? --GrandEscogriffe (talk) 19:47, 19 April 2022 (UTC)

Not yet: phab:T3605. --Matěj Suchánek (talk) 09:18, 22 April 2022 (UTC)

#ask with [[Property::{{PAGENAME}}]]

Hello !

On "this page", I want to display all the "Contact" which have "this page" in their Template.


We have :

Contact de test in the Contact category, with

{{Contact

...

|WorkGroup=This page

...

}}


So I tried with {{PAGENAME}} :

{{#ask: [[Category:Contact]] [[CommunityOfInterest::{{PAGENAME}}]] |?Function }}

Which should ask this :

{{#ask: [[Category:Contact]] [[CommunityOfInterest::This page]] |?Function }}

But it does not work.


Does anyone have an idea ?

Thank you ! Ypermat (talk) 14:28, 6 July 2022 (UTC)

tag: confusing example

See #Miscellaneous, #tag:. The example is:

"Example for the Cite extension's ‎<ref> tags:
{{#tag:ref|Citation on Magic words. |name = "multiple"}} → " &tc.

At the same time, there is a red warning text:

"... You must write {{#tag:tagname||attribute1=value1|attribute2=value2}} to pass an empty content. No leading or trailing space of the text content are permitted between the pipe characters || before attribute1.

This seems contradicting: in the example, there is a space in "words. |name", at exactly the forbidden place. Is there something I am missing? DePiep (talk) 12:06, 26 October 2022 (UTC)

  • The warning is I think specifically just about empty content, as leading/trailing space is preserved in the content. It is telling you that you must use || rather than | | if you want the content to be empty. For example, "{{#tag:span||}}" correctly produces "" (empty content) while "{{#tag:span| |}}" produces " " (non-empty content consisting of a space character). --Clump (talk) 12:57, 26 October 2022 (UTC)

Version at Meta has been soft-redirected to here

The version of this help page at Meta (i.e., m:Help:Magic words) has been deprecated in favor of this page. See the last "useful" revision of that page, which contains some things that might need to be merged into this page. (See also the corresponding talk page over there.) - dcljr (talk) 08:31, 5 March 2023 (UTC)

Do note that Help pages on Meta are under an differently license from help pages on MediaWiki.org (see Project:PD help), so wikitext can't be directly copied from there to here. * Pppery * it has begun 14:45, 5 March 2023 (UTC)

Basename without filename extension

Mention how

  • File:blabla.jpg could link to
  • File:blabla 2.jpg via a magic word.

It seems a new e.g., GUTNAME template would need to be invented, that strips off the filename extension:

  • [[:{{FULLGUTNAME}} 2.jpg]]

See also T6421. Jidanni (talk) 06:42, 6 March 2023 (UTC)

What are you actually suggesting here? If you're not referring to a currently existing feature that needs to be documented (better or at all) on this help page, then you're commenting in the wrong place. - dcljr (talk) 22:56, 6 March 2023 (UTC)
OK then it is a feature request, like the many seen above on this discussion page. Jidanni (talk) 03:18, 13 March 2023 (UTC)
Feature requests can be discussed at Project:Support desk or m:Tech and then requested formally at the Phabricator. - dcljr (talk) 00:03, 14 March 2023 (UTC)
Here's his Support Desk topic: Project:Support desk/Flow/2023/03#h-Feature_Request:_Basename_without_filename_extension-20230314005900. Jonathan3 (talk) 23:40, 18 March 2023 (UTC)
I don't see why this requires a magic word. Just use a lua module to parse the text and extract the substring up to the last . in the filename ? —TheDJ (Not WMF) (talkcontribs) 15:10, 14 March 2023 (UTC)
Well I read w:Wikipedia:Lua and it doesn't seem to work like {{PAGENAME}} that will even work for users not logged in viewing it. Well, OK, please put an example below. Thanks! Jidanni (talk) 00:22, 18 March 2023 (UTC)

No support questions. ... Right.

>"Please do not post support questions here."

Really!!

O well. Guess I just have to swallow my "{{NAMESPACE}}:{{PAGENAME}}" =?=> "{{{Self}}}", debugging related, question than. MvGulik (talk) 09:24, 10 June 2023 (UTC)

Support questions can be asked at Project:Support desk. - dcljr (talk) 03:22, 11 June 2023 (UTC)

No idea why, but this page has suddenly dropped out of google search. I don't see a __NOINDEX__ on it... in the past, whenever I typed "mediawiki" and "magic words" this help page was always the #1 hit, now the "Manual" namespace page shows up instead, or Wikipedia and other site versions, despite different browser/users. In other words, something is causing this page to drop out of Google Search. I'll bookmark it instead, but I'd imagine this would be a pretty widely used page. FrozenPlum (talk) 17:56, 14 September 2023 (UTC)

Yep, same thing with "Help:Templates", which has also dropped out of Google Search. For some reason, some pretty key pages are gettig de-indexed by Google. This is going to be super annoying. FrozenPlum (talk) 18:03, 14 September 2023 (UTC)
Both help pages do have "Indexing by robots: Allowed" [6][7]. --Matěj Suchánek (talk) 09:54, 17 September 2023 (UTC)

PAGENAME does not respect DISPLAYTITLE

If you are using {{DISPLAYTITLE}} to format a page name to have a leading lower case character (or really any formatting at all) the {{PAGENAME}} does not obey the display rule.

I think this is a bug.

47.186.29.164 47.186.29.164 01:12, 14 October 2023 (UTC)

This is not a bug, but a missing feature. However, if you want that behavior, there's an extension that provides it. See Extension:Display Title. Ciencia Al Poder (talk) 16:14, 14 October 2023 (UTC)
I wouldn’t even call it a missing feature. In many, probably most, cases, {{PAGENAME}} is used to get the page title for further processing (finding a subpage with the same name, its root page, using it in a conditional expression etc.). In these cases, any formatting is more harmful than useful. In addition, what if the wikitext fragment containing {{PAGENAME}} is processed before the wikitext fragment containing {{DISPLAYTITLE:…}}? It would lead to inconsistent results. —Tacsipacsi (talk) 13:39, 15 October 2023 (UTC)
Indeed, adding such a "feature" would cause a huge mess. One could add a separate parser function "{{READOUTTITLE}}" ... but let me guess that some could object this idea, since it could be abused as a replacement for the malicious Extension:Variables. Taylor 49 (talk) 14:58, 17 March 2024 (UTC)

Add a new magic word although if it is expensive

I suggest that the magic word "{{TRANSCLUSIONCOUNT}}" can be added, I'm sure it's quite expensive, what that function does is display the amount of transclusions it makes to itself, return 0 if is displayed on the source page, but return 1 if displayed from a page that transcludes the source page, return 2 if displayed from the page that transcludes the previous one, and so on, so it is possible to use it with "{{#ifexpr}}" to mainly prevent the main template containing that magic word from being transcluded a certain number of times 95.143.193.15 19:43, 4 October 2024 (UTC)

Usage of class="noresize"

The tables on this page appear to have recently been wrapped in class="noresize". I'm not entirely sure what the goal of doing this is (I imagine it's some kind of mobile support, although no information was provided in the edit summaries), but on Firefox on desktop it causes the tables to be enclosed in divs with scrollbars, with a pointless large block of space underneath them. It makes scrolling through this page substantially more inconvenient. I will revert this change, but if @Jdlrobson could explain what the purpose of these changes are, perhaps there is a way to apply the desired functionality without breaking the page on Firefox. SnorlaxMonster (talk) 06:12, 19 October 2024 (UTC)

The noresize class is documented here: Manual:Interface/IDs_and_classes and is in the process of being applied automatically by MediaWiki, so I've added this with that in mind.
Without it, tables overlap the sidebar on Vector 2022 and break the mobile site at certain resolutions as they are too large for the page: https://phabricator.wikimedia.org/F57626109 - impacting accessibility of important links
The issue with Firefox is new, looks like a cosmetic issue rather than a functional issue (I agree it's broken but inaccessible links is a greater bug than a block of whitespace at bottom of the element) and looks like it could be an upstream browser bug to me. Let's file a ticket and report that on Phabricator. Jdlrobson (talk) 16:38, 19 October 2024 (UTC)

URL data matching mobile or desktop?

fullurl, canonicalurl, etc. dont produce mobile view links while clicking them on mobile. is there a method to match output to the domain? if viewing on xx.m.yy.org the link should be the same and not xx.yy.org . RoyZuo (talk) 13:20, 29 November 2024 (UTC)

I don’t think so – I’m pretty sure the parser cache is shared between desktop and mobile, so we have to pick a domain name to be saved there. (Normal internal links work because they contain no domain name at all, just domain-relative /wiki/….) By the way, the whole mobile domain thing is a big hack – ideally, we’d have software that works greatly on small and large screens, with keyboard, mouse and touchscreen, and we wouldn’t have a separate mobile domain at all. But we’re far from that. —Tacsipacsi (talk) 22:04, 30 November 2024 (UTC)

WBREPONAME not mentioned

{{WBREPONAME}} and possibly many other Magic words are not mentioned here. For example, en:MediaWiki:Exceeded-entity-limit-category reads Pages with too many {{WBREPONAME}} entities accessed. {{WBREPONAME}} produces Wikidata. Even though these magic words might not be widely used, I think all of them should be properly documented here. —‍CX Zoom (A/अ/অ) (let's talk|contribs) 20:15, 6 January 2025 (UTC)

This page is only for magic words provided by MediaWiki core, not extensions. * Pppery * it has begun 20:40, 6 January 2025 (UTC)
Oh, I understand now. Thanks! —‍CX Zoom (A/अ/অ) (let's talk|contribs) 20:47, 6 January 2025 (UTC)

How to use #tag to show attributes that have no values?

I can use

{{#tag:syntaxhighlight|<b>test code</b>|lang="wikitext"}}

to render a syntaxhighlight tag like this:

<b>test code</b>

How can I use the same syntax to include the "inline" attribute, which takes no parameter value? Jonesey95 (talk) 00:50, 21 March 2025 (UTC)

Don't know if there is a rule for this, but at least inline="" works, because it is created by Visual Editor. Looks like inline= works too, but I'm not sure it's always the case. IKhitron (talk) 11:50, 21 March 2025 (UTC)