Template talk:Pagetype

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


{{editprotected}} This should be updated to account for |class=book. Headbomb {ταλκκοντριβς – WP Physics} 06:15, 11 December 2009 (UTC)

I'm not exactly sure what the behavior should be. Somewhat important when changing a template that is used 2.7 million times. —TheDJ (talkcontribs) 12:45, 11 December 2009 (UTC)
I don't think "books" is a proper classification here. Either way, these changes need to be made in a sandbox like Template:pagetype/sandbox to avoid breaking things. --MZMcBride (talk) 18:44, 11 December 2009 (UTC)


Should |class=needed be produce "page" or "article"? — Martin (MSGJ · talk) 07:27, 29 April 2010 (UTC)

I thought we didn't support Needed-Class anymore. Happymelon 15:24, 29 April 2010 (UTC)
But what about all the subcategories of Category:Needed-Class articles? — Martin (MSGJ · talk) 16:07, 29 April 2010 (UTC)
And the subcategories of Current-Class articles, or Merge-Class articles, or any of the other custom classes?? Those classes which we said should be available for projects to use if they wish, but for which we should not bloat banner code for all projects. There are 74 Needed-Class categories, 63 of which are empty. I don't agree that we should make any move to better integrate these niche classes when that disadvantages 1,600 projects for the sake of less than a dozen. Happymelon 21:31, 29 April 2010 (UTC)
Fair enough. I hadn't noticed that so many of them were empty. — Martin (MSGJ · talk) 10:32, 30 April 2010 (UTC)


I think a talkspace=yes, similar to subjectspace=yes, would be useful to have as an optional parameter for this template. It should, if on a talk page, return "talk page" and otherwise return the default value. This would be useful for templates like {{Last edited by}} to be more accurate or {{In use}} so we can get rid of the switch function there. --The Evil IP address (talk) 18:08, 6 June 2010 (UTC)

Sorry I can't understand what you mean. Can you describe the behaviour of the template with this new parameter? — Martin (MSGJ · talk) 18:46, 6 June 2010 (UTC)
Currently, on a talk page, this template shows the subject namespace, for example on an article talk page, it shows "article", on a template talk page it shows "template", and so on. However, there are situations in which it would be good to return "talk page" instead, for example within {{Last edited by}}. I'd like to add this template to {{Db-meta}} in the next time (which already uses a similar hardcoded function of this template), but since db templates are also used on talk pages, showing "article" or "template" wouldn't make sense there. --The Evil IP address (talk) 13:10, 9 June 2010 (UTC)
Ah now I understand. I would be open to such an addition if it can be coded cleanly without affecting the performance for the majority of uses (as this is a very widely used template!) Question: could you not just use {{NAMESPACE}} page in your case? — Martin (MSGJ · talk) 15:36, 9 June 2010 (UTC)
Fixed by using Template:pp-meta/pagetype instead. Prodego talk 23:59, 12 January 2011 (UTC)

Misleading documentation[edit]

According to the documentation there's a parameter "subjectspace - If set to yes then subjectspace pages will be treated the same as talkspace pages."

Without subjectspace: {{pagetype|page=Category:X1}} and {{pagetype|page=Category talk:X1}} produce "category" and "category".

With subjectspace: {{pagetype|page=Category:X1|subjectspace=yes}} and {{pagetype|page=Category talk:X1|subjectspace=yes}} produce "category" and "category".

There's an unnamed parameter, "class", but that's "optional" and the documentation suggests that it shouldn't affect the result in this case. Is the intention to require page name (which includes namespace) and namespace specified as separate parameters? Peter James (talk) 00:01, 22 September 2013 (UTC)

I've updated the docs to match what the template does. -- WOSlinker (talk) 00:15, 22 September 2013 (UTC)
It's still misleading. "This template is used to identify what kind of page it or its subject page is." - but when used with a page name, it returns "Article" for a template and "Template" for a template talk page. Is there something similar to Template:Pp-meta/pagetype (mentioned above) but allowing a parameter for page name? Peter James (talk) 08:02, 22 September 2013 (UTC)
This template was designed for use by WikiProject banners so it was mainly just tested on talk pages and currently doesn't do very well with non-talk pages. I'll have alook at doing something better in the sandbox soon. -- WOSlinker (talk) 08:33, 22 September 2013 (UTC)
I found it in use in Template:Edit protected and Template:Edit semi-protected, where parameter is needed because of a change to MediaWiki:Protectedpagetext. I've had to use TALKPAGENAME in those templates, which isn't ideal but produces the correct result (except in the unlikely event of a request for an edit to a redirected talk page). It may produce incorrect results if this template is changed, although it only affects the message and not the template's function. If improving or replacing this template, it may also be possible to use Module:Redirect to determine whether a page is a redirect, although it currently fails where "#REDIRECT:" (instead of just "#REDIRECT" is used. Peter James (talk) 10:12, 22 September 2013 (UTC)
Right, I've made some changes in the sandbox and now {{pagetype/sandbox|page=Category:X1}} and {{pagetype/sandbox|page=Category talk:X1}} produce "category" and "category". I've also removed the subjectspace option from the sandbox since it's not needed with the changes that I've made. Can you give it a test yourself & if you are happy, we can make it live. -- WOSlinker (talk) 13:30, 22 September 2013 (UTC)
It's an improvement for pages not in talk or article space, and does what the "output" section of the documentation says, with the exception of "portal" or "project" class in subjectspace - is that needed? Peter James (talk) 15:08, 22 September 2013 (UTC)
I think that's fine. I've updated the template and the docs. -- WOSlinker (talk) 16:07, 22 September 2013 (UTC)


I've created a Lua implementation of this template at Module:Pagetype. It's much more customisable than this template, and can be used to create other pagetype-like templates with different namespace configurations and custom text values. Have a look at the module documentation for details. The default settings are almost the same as this template, with one important difference - redirects are now detected and displayed as "redirect", no matter what namespace they are in. If this is undesirable I can change it, but it won't be easy to change the redirect detection on a per-namespace basis, due to the way the module hooks into Module:Namespace detect. Please have a look at the module, test it a bit, and see if there are any bugs, or anything you would like to change. You might also want to take a look at the test cases (results). If everything is ok, I plan to update {{pagetype}} with this module some time this week. — Mr. Stradivarius ♪ talk ♪ 14:07, 4 November 2013 (UTC)

Great! I notice that {{db-meta}} uses the following construction several times:
{{talk other|talk page|{{pagetype|subjectspace=yes}}}}
Does your version make this simpler to do? — Martin (MSGJ · talk) 11:23, 7 November 2013 (UTC)
Seems as though {{#invoke:pagetype|main|talk=y}} would work here as a shorter replacement. -- WOSlinker (talk) 12:00, 7 November 2013 (UTC)
Yes, that's right - you could also use {{#invoke:pagetype|main|defaultns=all}}, depending on how many namespaces you want to include by default. I also wasn't aware of the |subjectspace= parameter until now, as it was removed with this edit, so adding |subjectspace=yes to the module won't have any effect. — Mr. Stradivarius ♪ talk ♪ 14:13, 7 November 2013 (UTC)
Ok, I've made the switch to the new module. Let me know if you spot any issues. — Mr. Stradivarius ♪ talk ♪ 07:50, 9 November 2013 (UTC)

Misleading message about redirect[edit]

Moved from Template talk:Edit protected: Jackmcbarn (talk) 19:16, 3 April 2014 (UTC)

If you put {{Edit protected|MediaWiki talk:Spam-blacklist/log}} on MediaWiki talk:Spam-blacklist, the box begins with "It is requested that an edit be made to the fully protected redirect at MediaWiki talk:Spam-blacklist/log.". Why "redirect", when MediaWiki talk:Spam-blacklist/log isn't? See this permalink. --Redrose64 (talk) 18:54, 3 April 2014 (UTC)

@Mr. Stradivarius: The issue is that when p._main{page='MediaWiki talk:Spam-blacklist/log'} is called, checkRedirects instead checks to see if MediaWiki:Spam-blacklist/log is a redirect (lines 208-211). I'm not sure what the logic behind doing that that way is. Thoughts? Jackmcbarn (talk) 19:16, 3 April 2014 (UTC)
Yep, that's a bug in the module. It should use the current page rather than the subject page if talk pages are allowed, but at the moment it only checks args.talk, not args.defaultns. I'll have a think about how best to fix this. (Also, your ping didn't work - not sure why.) — Mr. Stradivarius ♪ talk ♪ 04:12, 4 April 2014 (UTC)
Now fixed. I also uncovered a nasty bug that was introduced by the recent changes to Module:Namespace detect - this module was trying to use the # operator with the mappings table, which didn't work after it was switched to load using mw.loadData. I also split out the config data to Module:Pagetype/config, loaded using mw.loadData. And I made some beautification fixes too. — Mr. Stradivarius ♪ talk ♪ 06:01, 4 April 2014 (UTC)
I didn't get a ping either. It might be because it was a page creation? --Redrose64 (talk) 10:18, 4 April 2014 (UTC)
@Mr. Stradivarius: Broken in the opposite way now. [1] says talk page instead of module. Jackmcbarn (talk) 16:05, 5 April 2014 (UTC)
Bleh. That was a bug I introduced to Module:Namespace detect this morning trying to fix an unrelated issue. That's now fixed as well. And with that, I think I shall call it a night. If you notice other similar problems, purging should fix it. — Mr. Stradivarius ♪ talk ♪ 17:13, 5 April 2014 (UTC)


I don't think this module identifies pages in the draft namespace. Please could this be added? — Martin (MSGJ · talk) 11:40, 3 October 2014 (UTC)

You could either use {{pagetype|draft=true}} or you could edit the cfg.defaultNamespaces section of Module:Pagetype/config. -- WOSlinker (talk) 11:56, 3 October 2014 (UTC)
@MSGJ: Drafts are detected fine - they are one of the extended namespaces. See Module:Pagetype#Default namespace sets for a quick look at what is in what set. And if you think drafts should be in the default set instead of just the extended set, we can make the change in the module config, as WOSlinker said. (We should probably get consensus for that first, though.) — Mr. Stradivarius ♪ talk ♪ 13:13, 3 October 2014 (UTC)
Yes well, perhaps "draft" should be in that set. Also I'm surprised that "file" is not there. — Martin (MSGJ · talk) 13:51, 3 October 2014 (UTC)
Hmm I see "file" is there, but not in the "media" row so I'm a bit confused by that. — Martin (MSGJ · talk) 13:53, 3 October 2014 (UTC)
@MSGJ: That's because when you click a link to a media namespace page, you're not going to a wiki page, but you're viewing the file directly. For example: Media:Example.svg. — Mr. Stradivarius ♪ talk ♪ 14:00, 3 October 2014 (UTC)
Interesting, I didn't know that! In the meantime I've used |draft=yes on Template:Importance mask so it works as intended. Cheers all — Martin (MSGJ · talk) 11:29, 4 October 2014 (UTC)

Protected edit request on 28 September 2015[edit]

Add the Gadget and Gadget definition namespaces and make the page type the same name, but with a lowercase "G". GeoffreyT2000 (talk) 02:50, 28 September 2015 (UTC)

Yes check.svg DoneMr. Stradivarius ♪ talk ♪ 03:41, 28 September 2015 (UTC)

Set index articles[edit]

@Mr. Stradivarius: Is there any way for the module to distinguish between disambiguation pages and set index articles? PC78 (talk) 00:06, 5 July 2016 (UTC)

I asked about disambiguation pages somewhere before and was told that it is impossible ;( — Martin (MSGJ · talk) 11:28, 12 July 2016 (UTC)
@PC78: see Module talk:Redirect#Query — Martin (MSGJ · talk) 11:32, 12 July 2016 (UTC)
Hmm. The doc refers to disambiguation pages at Module:Pagetype/doc#Main namespace classes. Does this not do what I think it does? PC78 (talk) 17:02, 12 July 2016 (UTC)
You have to tell the module that it is a disambiguation page using the class parameter. It won't detect it automatically, which I think it what you were asking about. — Martin (MSGJ · talk) 19:25, 12 July 2016 (UTC)
Ah-ha. How does the Metadata gadget do it then, is that not something that can be applied to a template? PC78 (talk) 06:49, 13 July 2016 (UTC)

Detecting disambiguation pages[edit]

Would it be possible to detect disambiguation pages from this module? Disambiguation pages have the page property "disambiguation". Can you retrieve page properties from Lua modules? Kaldari (talk) 20:44, 31 October 2016 (UTC)

Please see Module talk:Redirect#Query! — Martin (MSGJ · talk) 20:54, 31 October 2016 (UTC)
Thanks for the pointer. After looking at the Phab ticket and the Scribunto code, I think I actually know how this could be implemented. Kaldari (talk) 21:19, 31 October 2016 (UTC)