Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Search
Search
Appearance
Create account
Log in
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Editing
Template talk
:
Pagetype
Add topic
Template
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
Add topic
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{central|Module talk:Pagetype}} {{permprot}} {{copied|from=Template:Pagetype|from_oldid=616197024|to=:incubator:Template:Wp/nod/pagetype|to_diff=4242185}} ==Books== {{tlx|editprotected}} This should be updated to account for |class=book. [[User:Headbomb|Headbomb]] {<sup>[[User talk:Headbomb|ταλκ]]</sup><sub style="margin-left:-4.0ex;">[[Special:Contributions/Headbomb|κοντριβς]]</sub> – [[WP:PHYS|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. —[[User:TheDJ|Th<span style="color: green">e</span>DJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 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. --[[User:MZMcBride|MZMcBride]] ([[User talk:MZMcBride|talk]]) 18:44, 11 December 2009 (UTC) ==Needed== Should {{para|class|needed}} be produce "page" or "article"? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 07:27, 29 April 2010 (UTC) :I thought we didn't support Needed-Class anymore. [[User:Happy-melon|<span style="color:forestgreen">'''Happy'''</span>]]‑[[User talk:Happy-melon|<span style="color:darkorange">'''melon'''</span>]] 15:24, 29 April 2010 (UTC) ::But what about all the subcategories of [[:Category:Needed-Class articles]]? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 16:07, 29 April 2010 (UTC) :::And the subcategories of [[:Category:Current-Class articles|Current-Class articles]], or [[:Category:Merge-Class articles|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. [[User:Happy-melon|<span style="color:forestgreen">'''Happy'''</span>]]‑[[User talk:Happy-melon|<span style="color:darkorange">'''melon'''</span>]] 21:31, 29 April 2010 (UTC) ::::Fair enough. I hadn't noticed that so many of them were empty. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 10:32, 30 April 2010 (UTC) == talkspace=yes == 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 {{Tl|Last edited by}} to be more accurate or {{Tl|In use}} so we can get rid of the switch function there. --[[User:The Evil IP address|The Evil IP address]] ([[User talk: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 <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 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 {{Tl|Last edited by}}. I'd like to add this template to {{Tl|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. --[[User:The Evil IP address|The Evil IP address]] ([[User talk: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 '''<nowiki>{{NAMESPACE}} page</nowiki>''' in your case? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 15:36, 9 June 2010 (UTC) ::::Fixed by using [[Template:pp-meta/pagetype]] instead. [[User:Prodego|<span style="color:darkgreen;">''Prodego''</span>]] [[User talk:Prodego|<sup style="color:darkgreen;">talk</sup>]] 23:59, 12 January 2011 (UTC) == Misleading documentation == 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: <nowiki>{{pagetype|page=Category:X1}} and {{pagetype|page=Category talk:X1}}</nowiki> produce "{{pagetype|page=Category:X1}}" and "{{pagetype|page=Category talk:X1}}". With subjectspace: <nowiki>{{pagetype|page=Category:X1|subjectspace=yes}} and {{pagetype|page=Category talk:X1|subjectspace=yes}}</nowiki> produce "{{pagetype|page=Category:X1|subjectspace=yes}}" and "{{pagetype|page=Category talk:X1|subjectspace=yes}}". 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? [[User:Peter James|Peter James]] ([[User talk:Peter James|talk]]) 00:01, 22 September 2013 (UTC) :I've updated the docs to match what the template does. -- [[User:WOSlinker|WOSlinker]] ([[User talk: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? [[User:Peter James|Peter James]] ([[User talk: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. -- [[User:WOSlinker|WOSlinker]] ([[User talk: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 [https://en.wikipedia.org/w/index.php?title=MediaWiki:Protectedpagetext&diff=564379718&oldid=560600426 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. [[User:Peter James|Peter James]] ([[User talk:Peter James|talk]]) 10:12, 22 September 2013 (UTC) :::::Right, I've made some changes in the sandbox and now <nowiki>{{pagetype/sandbox|page=Category:X1}} and {{pagetype/sandbox|page=Category talk:X1}}</nowiki> produce "{{pagetype/sandbox|page=Category:X1}}" and "{{pagetype/sandbox|page=Category talk:X1}}". 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. -- [[User:WOSlinker|WOSlinker]] ([[User talk: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? [[User:Peter James|Peter James]] ([[User talk:Peter James|talk]]) 15:08, 22 September 2013 (UTC) :::::::I think that's fine. I've updated the template and the docs. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 16:07, 22 September 2013 (UTC) == Module:Pagetype == 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 [[Module:Pagetype/testcases|test cases]] ([[Module talk:Pagetype/testcases|results]]). If everything is ok, I plan to update {{tl|pagetype}} with this module some time this week. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 14:07, 4 November 2013 (UTC) :Great! I notice that {{tl|db-meta}} uses the following construction several times: <pre>{{talk other|talk page|{{pagetype|subjectspace=yes}}}}</pre> :Does your version make this simpler to do? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 11:23, 7 November 2013 (UTC) ::Seems as though <code><nowiki>{{#invoke:pagetype|main|talk=y}}</nowiki></code> would work here as a shorter replacement. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 12:00, 7 November 2013 (UTC) :::Yes, that's right - you could also use <code><nowiki>{{#invoke:pagetype|main|defaultns=all}}</nowiki></code>, depending on how many namespaces you want to include by default. I also wasn't aware of the {{para|subjectspace}} parameter until now, as it was removed with [https://en.wikipedia.org/w/index.php?title=Template:Pagetype&diff=574059272&oldid=541587542 this edit], so adding {{para|subjectspace|yes}} to the module won't have any effect. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 14:13, 7 November 2013 (UTC) ::::Ok, I've made the switch to the new module. Let me know if you spot any issues. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 07:50, 9 November 2013 (UTC) == Misleading message about redirect == {{moved from|Template talk:Edit protected|[[User:Jackmcbarn|Jackmcbarn]] ([[User talk:Jackmcbarn|talk]]) 19:16, 3 April 2014 (UTC)}} If you put {{tlx|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 {{oldid|MediaWiki talk:Spam-blacklist|602617506#Full_log|this permalink}}. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 18:54, 3 April 2014 (UTC) :{{ping|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? [[User:Jackmcbarn|Jackmcbarn]] ([[User talk: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.) — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 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. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 06:01, 4 April 2014 (UTC) :::I didn't get a ping either. It might be because it was a page creation? --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 10:18, 4 April 2014 (UTC) ::::{{ping|Mr. Stradivarius}} Broken in the opposite way now. [{{fullurl:Module talk:Message box|oldid=602879313#Protected_edit_request_on_5_April_2014}}] says talk page instead of module. [[User:Jackmcbarn|Jackmcbarn]] ([[User talk: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. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 17:13, 5 April 2014 (UTC) == Drafts == I don't think this module identifies pages in the draft namespace. Please could this be added? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 11:40, 3 October 2014 (UTC) :You could either use <nowiki>{{pagetype|draft=true}}</nowiki> or you could edit the cfg.defaultNamespaces section of [[Module:Pagetype/config]]. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 11:56, 3 October 2014 (UTC) ::{{ping|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.) — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 13:13, 3 October 2014 (UTC) :::Yes well, perhaps "draft" should be in that set. <s>Also I'm surprised that "file" is not there.</s> — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 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 <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 13:53, 3 October 2014 (UTC) ::::{{ping|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]]. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 14:00, 3 October 2014 (UTC) :::::Interesting, I didn't know that! In the meantime I've used {{para|draft|yes}} on [[Template:Importance mask]] so it works as intended. Cheers all — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 11:29, 4 October 2014 (UTC) == Protected edit request on 28 September 2015 == {{edit fully-protected|Module:Pagetype|answered=yes}} <!-- Begin request --> Add the Gadget and Gadget definition namespaces and make the page type the same name, but with a lowercase "G".<!-- This will mean that if a speedy deletion template is placed on a page in one of those namespaces, then the page will say "This gadget may meet Wikipedia's criteria for speedy deletion" or "This gadget definition may meet Wikipedia's criteria for speedy deletion". --> <!-- End request --> [[User:GeoffreyT2000|GeoffreyT2000]] ([[User talk:GeoffreyT2000|talk]]) 02:50, 28 September 2015 (UTC) :[[File:Yes check.svg|20px|link=]] '''Done'''<!-- Template:EP --> — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 03:41, 28 September 2015 (UTC) == Set index articles == {{re|Mr. Stradivarius}} Is there any way for the module to distinguish between disambiguation pages and set index articles? [[User:PC78|PC78]] ([[User talk:PC78|talk]]) 00:06, 5 July 2016 (UTC) :I asked about disambiguation pages somewhere before and was told that it is impossible ;( — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 11:28, 12 July 2016 (UTC) :{{ping|PC78}} see [[Module talk:Redirect#Query]] — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 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? [[User:PC78|PC78]] ([[User talk: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 <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 19:25, 12 July 2016 (UTC) ::::Ah-ha. How does the [[Wikipedia:Metadata gadget|Metadata gadget]] do it then, is that not something that can be applied to a template? [[User:PC78|PC78]] ([[User talk:PC78|talk]]) 06:49, 13 July 2016 (UTC) :::::The gadget also uses the class rating from the article's talk page, I believe! — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:36, 20 April 2023 (UTC) == Detecting disambiguation pages == {{tracked|T71441}} 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? [[User:Kaldari|Kaldari]] ([[User talk:Kaldari|talk]]) 20:44, 31 October 2016 (UTC) :Please see [[Module talk:Redirect#Query]]! — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 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. [[User:Kaldari|Kaldari]] ([[User talk:Kaldari|talk]]) 21:19, 31 October 2016 (UTC) == cross project calls == Should this work across wikiprojects? For example * <nowiki>{{#invoke:pagetype|main|page=Frankfurt}}</nowiki> gives: {{#invoke:pagetype|main|page=Frankfurt}} * <nowiki>{{#invoke:pagetype|main|page=Wikipedia:Frankfurt}}</nowiki> gives: {{#invoke:pagetype|main|page=Wikipedia:Frankfurt}} * <nowiki>{{#invoke:pagetype|main|page=Wikivoyage:Frankfurt}}</nowiki> gives: {{#invoke:pagetype|main|page=Wikivoyage:Frankfurt}} * <nowiki>{{#invoke:pagetype|main|page=Voy:Frankfurt}}</nowiki> gives: {{#invoke:pagetype|main|page=Voy:Frankfurt}} * <nowiki>{{#invoke:pagetype|main|page=Frankfurt/Main}}</nowiki> gives: {{#invoke:pagetype|main|page=Frankfurt/Main}} * <nowiki>{{#invoke:pagetype|main|page=Wikipedia:Frankfurt/Main}}</nowiki> gives: {{#invoke:pagetype|main|page=Wikipedia:Frankfurt/Main}} * <nowiki>{{#invoke:pagetype|main|page=W:Frankfurt/Main}}</nowiki> gives: {{#invoke:pagetype|main|page=W:Frankfurt/Main}} * <nowiki>{{#invoke:pagetype|main|page=Wikipedia:Frankfurt/Main123}}</nowiki> gives: {{#invoke:pagetype|main|page=Wikipedia:Frankfurt/Main123}} * <nowiki>{{#invoke:pagetype|main|page=Wikivoyage:Frankfurt/Main}}</nowiki> gives: {{#invoke:pagetype|main|page=Wikivoyage:Frankfurt/Main}} * <nowiki>{{#invoke:pagetype|main|page=FRA}}</nowiki> gives: {{#invoke:pagetype|main|page=FRA}} * <nowiki>{{#invoke:pagetype|main|page=Wikipedia:FRA}}</nowiki> gives: {{#invoke:pagetype|main|page=Wikipedia:FRA}} * <nowiki>{{#invoke:pagetype|main|page=W:FRA}}</nowiki> gives: {{#invoke:pagetype|main|page=W:FRA}} * <nowiki>{{#invoke:pagetype|main|page=Wikivoyage:FRA}}</nowiki> gives: {{#invoke:pagetype|main|page=Wikivoyage:FRA}} * <nowiki>{{#invoke:pagetype|main|page=Voy:FRA}}</nowiki> gives: {{#invoke:pagetype|main|page=Voy:FRA}} Does not appear to be giving correct results, or am I misunderstanding the syntax? --[[User:Traveler100|Traveler100]] ([[User talk:Traveler100|talk]]) 12:21, 15 February 2018 (UTC) :I don't believe this is possible and/or desirable — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:46, 20 April 2023 (UTC) == Plurals == Following a request at [[Wikipedia talk:Short description #Category fix needed]], which complained that the {{tl|Short description}} naively pluralises 'category' as '<del>categories</del><ins>categorys</ins>', I looked for a fix. As the template calls [[Template:Pagetype]] in three places, it seemed hugely inefficient to use logic to test for irregular plurals at each call, so I've implemented a boolean {{para|plural}} parameter in [[Module:Pagetype/sandbox]]. That makes use of a couple of extra variables that I've added to [[Module:Pagetype/config/sandbox]] (to allow localisation for other Wikis). I've set each respective sandbox to call the relevant sandbox. So: * <code><nowiki>{{pagetype/sandbox}}</nowiki></code> → {{pagetype/sandbox}} * <code><nowiki>{{pagetype/sandbox |plural=y}}</nowiki></code> → {{pagetype/sandbox |plural=y}} * <code><nowiki>{{pagetype/sandbox |plural=n |page=Category:CS1 maint: archived copy as title}}</nowiki></code> → {{pagetype/sandbox |plural=n |page=Category:CS1 maint: archived copy as title}} * <code><nowiki>{{pagetype/sandbox |plural=y |page=Category:CS1 maint: archived copy as title}}</nowiki></code> → {{pagetype/sandbox |plural=y |page=Category:CS1 maint: archived copy as title}} It seems to work without problem on each type of page, including redirects where I've previewed the above code. It fails the same four testcases at [[Module talk:Pagetype/testcases]] that were failing before (pages that are now redirects). As I'm not familiar with the uses of the less common parameters (although there ''should'' be no interaction as I've coded the changes at the output of the main function), I'm flagging this up for review and to seek consensus for the changes to be made. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 23:16, 24 May 2020 (UTC) Sorry, I should have pinged {{u|Mr. Stradivarius}} as the author of the module. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 23:19, 24 May 2020 (UTC) :I support this change, with a minor note that for posterity, I think your original description of the error should read {{tq|naively pluralises 'category' as 'categorys'}} (note the misspelled last word). I was going to strike it out for you, but I might be misunderstanding the situation entirely. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 23:40, 24 May 2020 (UTC) :: Thanks for spotting that, {{u|Jonesey95}} – my internal spell-checker clearly took over (either that or my senility is progressing faster than I thought). Cheers --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 23:50, 24 May 2020 (UTC) :::{{ping|RexxS}} thanks for coding this, and please do implement — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 15:25, 9 June 2020 (UTC) :::: Apologies, I did that last week, but forgot to update this thread. This template now accepts the {{para|plural}} parameter: ::::* <code><nowiki>{{pagetype}}</nowiki></code> → {{pagetype}} ::::* <code><nowiki>{{pagetype |plural=y}}</nowiki></code> → {{pagetype |plural=y}} ::::* <code><nowiki>{{pagetype |plural=n |page=Category:CS1 maint: archived copy as title}}</nowiki></code> → {{pagetype |plural=n |page=Category:CS1 maint: archived copy as title}} ::::* <code><nowiki>{{pagetype |plural=y |page=Category:CS1 maint: archived copy as title}}</nowiki></code> → {{pagetype |plural=y |page=Category:CS1 maint: archived copy as title}} :::: I've updated the documentation at [[Template:Pagetype/doc #Plurals]]. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 16:07, 9 June 2020 (UTC) == Protected edit request on 18 June 2020 == {{edit fully-protected|Module:Pagetype|answered=yes}} Implement the change I've made at [[Module:Pagetype/sandbox]]; specifically, the addition of a {{para|caps}} parameter, that capitalises the first letter of the output. The change is very simple; below line 209, insert the following: <syntaxhighlight lang="lua" line start="210"> if yesno(args.caps, false) then pagetype = mw.ustring.upper(mw.ustring.sub(pagetype, 1, 1)) .. mw.ustring.sub(pagetype, 2) end </syntaxhighlight> <small>The indentation on the output above is... interesting... but the correct indentation is used in the wikitext.</small> You can see this working in the [[Module talk:Pagetype/testcases|test cases]], where I've written specific tests for it; it plays nicely with the {{para|plural}} parameter, as you'd expect. It is worthy of note that I've [https://en.wikipedia.org/w/index.php?title=Module%3APagetype%2Ftestcases&type=revision&diff=963243595&oldid=963242397 had to separately fix some of the other testcases], as the pages that they depended on have changed since the last time the testcases were used. Please let me know once this is sorted so I can update the documentation for the new parameter. Thanks! [[User:Naypta|Naypta]] ☺ | <small>[[User talk:Naypta|✉ talk page]]</small> | 18:40, 18 June 2020 (UTC) [[User:Naypta|Naypta]] ☺ | <small>[[User talk:Naypta|✉ talk page]]</small> | 18:40, 18 June 2020 (UTC) : : The code works fine, but is there a use case for it? As an aside, <code>:gsub("^(%l)", string.upper)</code> is a compact way of doing ucfirst (that's %'lower-case-L' in the pattern). --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 20:27, 18 June 2020 (UTC) ::{{re|RexxS}} The intended use case would be to have templates that either categorise pages, or link to categories of pages, shown correctly with the capitalisation of the first letter of the category. In the first case, which was actually what prompted me to propose this change, there's not much practical difference, because MediaWiki doesn't care about first letter capitalisation, and categories are processed through it. In the second, however, there's a visible difference for people looking at the link. It's no big deal, but it's a nice thing to have, and for the few lines of code it takes to support it, I figured why not {{=)}}{{pb}}Thanks for the tip about ucfirst - I'd not thought of just using a gsub, good shout! [[User:Naypta|Naypta]] ☺ | <small>[[User talk:Naypta|✉ talk page]]</small> | 21:06, 18 June 2020 (UTC) ::: {{re|Naypta}} I've implemented your change and tidied the odd indent. Please check it over and update the documentation when you get a chance. Cheers. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 21:28, 18 June 2020 (UTC) ::::{{re|RexxS}} [https://en.wikipedia.org/w/index.php?title=Template:Pagetype/doc&type=revision&diff=963273850&oldid=960209712&diffmode=source Done] and [https://en.wikipedia.org/w/index.php?title=Module:Pagetype/doc&action=historysubmit&type=revision&diff=963273701&oldid=960209682&diffmode=source dusted] - cheers! I've also added TemplateData for {{para|plural}}, and tidied up the documentation on the template to use examples of template code rather than of module code. {{=)}} [[User:Naypta|Naypta]] ☺ | <small>[[User talk:Naypta|✉ talk page]]</small> | 21:37, 18 June 2020 (UTC) == Question regarding the use of the dab parameter == I'm not sure I understand how the {{para|dab}} parameter works. I have a usecase that I want to check if a page is an actual article or a dab or redirect. If I understand correctly from the docs I should do: * <code><nowiki>{{Pagetype|page=AC|dab}}</nowiki></code>, which produces: {{Pagetype|page=AC|dab}} * <code><nowiki>{{Pagetype|page=Air conditioning|dab}}</nowiki></code>, which produces: {{Pagetype|page=Air conditioning|dab}} The first is a dab while the second is an article. What am I doing wrong? --[[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 10:42, 2 July 2020 (UTC) :I don't think there is any way to check if a page is a disambig automatically, so what you are doing above is passing in the class value and because the class value you've passed is "dab", it outputs "page". If you have passed "start" for example then it would have output "article". :* <code><nowiki>{{Pagetype|page=AC|start}}</nowiki></code>, which produces: {{Pagetype|page=AC|start}} :You can see what's possible against the Title object in the [https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Title_objects LUA reference manual] and you'll see that there are items to check for redirects but nothing for disambig. Also see [https://phabricator.wikimedia.org/T71441 phabricator T71441].-- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 13:42, 2 July 2020 (UTC) ::Yeah I know there is no direct access, but I thought there was some backend manipulation the page content. So I'm not sure what the point is of the dab class. If I already know what the page type is, why would I send the page type, or even use this template in the first place? I feel like I'm missing something here. --[[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 13:51, 2 July 2020 (UTC) ::: A couple of hacks come to mind that could determine whether a page is a dab page: :::* Using a call to a Scribunto module that fetches the content of the page, <code>titleobject.getcontent()</code>, and then looks for the {{tl|disambiguation}} template in it. Heavy and expensive. :::* If you're checking from Wikidata from an entity, use the fact that <code>titleobject.redirectTarget</code> returns false if the page is not a redirect; and <code>mw.wikibase.getSitelink(qid)</code> returns nil if the page has no Wikidata sitelink. If an article page has no Wikidata sitelink and is not a redirect, it is almost certainly a dab. ::: There are possibly others, but I'm not aware of any 100% guaranteed way that doesn't depend on some assumptions. --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 15:49, 2 July 2020 (UTC) ::::{{Ping|RexxS}}, thanks. I've been looking into the page:content() before I came here. Can you explain to me what's the purpose of the dab parameter? --[[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 16:04, 2 July 2020 (UTC) :::::There's more than just the disambiguation template to look for, there's some of the [https://en.wikipedia.org/w/index.php?title=Special:WhatLinksHere/Template:Dmbox&namespace=10&limit=110&hidelinks=1 following] templates that are also used for that purpose as well. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 16:40, 2 July 2020 (UTC) :::The main purpose of the Pagetype template is to be used on the project banners to show either "article" or "page" in the banner text. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 16:33, 2 July 2020 (UTC) :::: {{re|Gonnym}} As an example, if this template is used inside a WikiProject template, it can read the {{para|class}} parameter (passed into the WikiProject template) like this: <code><nowiki>{{pagetype|{{{class|}}} }}</nowiki></code> and then might be used to create a category name that the article should belong to, given that if the class is given as dab or n/a, the template will then return "page" instead of "article". There is the ability to specify custom text for either dab or n/a, depending on the naming convention required for the category name. Does that make sense? --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 20:42, 2 July 2020 (UTC) :::::Yes, thanks! --[[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 22:25, 2 July 2020 (UTC) == Erroneous entries in WhatLinksHere == Using this template on a file talk page causes [[Special:WhatLinksHere]] for the file page to report the talk page linking to the file page. If this is fixable, please do. See also [[Template talk:WPBannerMeta#Protected edit request on 29 July 2021]]. — <span style="color:#e08020">Alexis Jazz</span> ([[User talk:Alexis Jazz|talk]] or ping me) 11:36, 29 July 2021 (UTC) == Protected edit request on 2 May 2022 == {{edit fully-protected|Template:Pagetype|answered=yes}} Change page's main title Sterling Entertainment Group to United American Video and lock the page from further editing. The information on this page is wildly inaccurate and most of it has now been edited for accuracy except for the main title. United American Video was never Sterling Entertainment Group. I should know I was a founder from 1984 to 2005. [[User:Jpettus1|Jpettus1]] ([[User talk:Jpettus1|talk]]) 16:29, 2 May 2022 (UTC) :{{not done}} this has nothing to do with editing [[Template:Pagetype]]; try the talk page attached to whichever article you want to change. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 18:31, 2 May 2022 (UTC) == Use [[Module:Disambiguation]] == I propose using [[Module:Disambiguation]] to automatically detect disambiguation pages, as currently used on [[Module:Class mask]] — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:50, 20 April 2023 (UTC) :@[[User:Mr. Stradivarius|Mr. Stradivarius]]: any chance you could look at this, because I think you wrote this module initialy? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 10:21, 10 May 2023 (UTC) :@[[User:Mr. Stradivarius|Mr. Stradivarius]]: if you do have time to look at this module, it would be appreciated. It does have a significant effect because importance is not being correctly autoclassified as NA on disambiguation talk pages. Thanks — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:47, 18 May 2023 (UTC) ::Time is one thing I don't have the luxury of right now... but perhaps I can take a look at some point in the next few weeks. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 00:25, 19 May 2023 (UTC) :::@[[User:Mr. Stradivarius|Mr. Stradivarius]] just a little reminder if you have time to look at this :) Would it also be possible for {{para|defaultns|extended}} to produce "disambiguation page" in this case? Thank you. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 05:10, 19 August 2023 (UTC) ::::{{ping|MSGJ}} I have implemented disambiguation page detection at [[Module:Pagetype/sandbox]]. At the moment, this still outputs the default "page" for disambiguation pages. Disambiguation detection works like redirect detection - it is on by default, and is checked before looking at {{para|defaultns}} or explicit namespace arguments. This means that if we are going to change the module to produce "disambiguation page" for disambiguation pages, with the current implementation this would be independent of the value of {{para|defaultns}}. (It can be done by editing the <code>cfg.dabDefault</code> value in [[Module:Pagetype/config/sandbox]].) <p>Using "disambiguation page" could be a breaking change for some users, as previously disambiguation pages specified by the first positional parameter have been output as "page". Before changing it, we should probably check to see whether anything is likely to break, and have a wider discussion. In the meantime, you can always change it on a per-template basis by using {{para|dab|disambiguation page}}.</p> <p>My edits to the sandbox have also removed the dependency on [[Module:Namespace detect]], and I also changed [[Module:Pagetype/testcases]] to use [[Module:Mock title]] so that the test cases won't break if anyone edits any pages mentioned in them. Let me know if you spot any issues with any of this, and if not I'll go ahead and deploy the sandbox version to the main module. Best — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 07:34, 27 August 2023 (UTC)</p> :::::I have gone ahead and deployed the changes to the main module. Please let me know if you spot any issues. Best — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 13:39, 28 August 2023 (UTC) ::::::Thanks very much. I'll test it very soon when I get some time. I can use {{para|dab|disambguation}} for now but it would be great if defaultns could be used later, if that is possible — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 20:56, 28 August 2023 (UTC) :::::::{{ping|MSGJ}} I think changing the default would break too many things. Changing to automatic disambiguation page detection has already [[Wikipedia talk:Short description#Category transclusion|broken the categories]] used by [[Template:Short description]], and it is difficult to tell what else might break by changing the default wording from "page" to "disambiguation page". — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 13:19, 29 August 2023 (UTC) ::::::::{{ping|Mr. Stradivarius|MSGJ}} The WikiProject classification for some disambiguation pages such as [[Dragon Quest Heroes]] moved from being "NA-importance" by default to "Unknown-importance" as of today; since no change was made to Wikiproject banner shell, I think that this change may have affected that template/module. In looking at what moved and what didn't, it appears that "set index articles" are now no longer "NA" by default, while "normal" disambiguation articles are still handled correctly. I'm presuming that the fix needs to be applied to Wikiproject banner shell, not here, but replying here since there was an active discussion. --'''[[User:PresN|<span style="color:green">Pres</span>]][[User talk:PresN|<span style="color:blue">N</span>]]''' 02:21, 30 August 2023 (UTC) :::::::::{{ping|PresN}} I tracked the problem down to [[Module:WikiProject banner]]. It uses [[Module:Pagetype]] [[Module:WikiProject banner#L-109|here]], and then compares the result to the string "article" [[Module:WikiProject banner#L-312|here]]. This should probably be changed to a namespace check. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 02:55, 30 August 2023 (UTC) ::::::::::{{re|Mr. Stradivarius}} I think it's actually that [[Module:Disambiguation]] only looks for ''disambiguation'' templates, but set index pages have ''set index'' templates, so they don't get counted by the module as a disambiguation page, so Module:Pagetype is saying they're "article". Either Module:Disambiguation should treat those like disambig pages, or else Module:Pagetype should call a [[Module:Set index]] with its own regex patterns to handle set index pages. --'''[[User:PresN|<span style="color:green">Pres</span>]][[User talk:PresN|<span style="color:blue">N</span>]]''' 11:48, 30 August 2023 (UTC) :::::::::::{{ping|PresN}} Hm, you are right: <code><nowiki>{{pagetype|page=Dragon Quest Heroes}}</nowiki></code> produces "article". This means that the recent change to [[Module:Pagetype]] won't have affected it (unless it was passing "dab" as the first positional parameter, which not many pages do). So there must be another reason for the change from "NA-importance" to "Unknown-importance". By the way, I don't think that set index articles not being detected as disambiguation pages by [[Module:Disambiguation]] is an error. From [[WP:SETINDEX]]: {{tq|A set index article (SIA) is a ''list article'' about a set of items of a specific type that also share the same (or similar) name}} (italics mine). Also, there's an entire section [[WP:SETNOTDAB]] explaining that set index articles are not disambiguation pages. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 13:26, 30 August 2023 (UTC) ::::::::::::{{re|Mr. Stradivarius}} Hmm. Given the definition and examples at that page (e.g. [[List of peaks named Signal]]), I see the argument for pagetype treating them as "article" rather than "disambiguation". I also don't think the pages I was looking at are really SIAs by that definition, but should be disambiguation pages. I'll adjust in that direction, and we can leave pagetype as it is. Still not sure what caused banner shell to stop treating them as disambiguation (I don't see anything in the code change that would cause it), but if its more correct this way then that's fine. --'''[[User:PresN|<span style="color:green">Pres</span>]][[User talk:PresN|<span style="color:blue">N</span>]]''' 13:52, 30 August 2023 (UTC) :::::::::::::I must admit that the definition of set index articles confuses me, but the "article" in its name makes it clear that they are articles so I don't there is an error here. I also don't see how the recent change could have affected this — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 20:30, 30 August 2023 (UTC) ::::::::::::::I'm still confused how it did, but there were some SIAs where the talk page template said "|class=Disambiguation" with no importance listed, and yesterday they moved from defaulting as NA-importance to being Unknown-importance. It was consistent on the 1.0 Bot assessment logs. It appears that the current state of things is the correct and intended way, and whatever was treating SIAs as disambiguation pages instead of lists was wrong, so nothing further to do here. --'''[[User:PresN|<span style="color:green">Pres</span>]][[User talk:PresN|<span style="color:blue">N</span>]]''' 21:41, 30 August 2023 (UTC) :Lots of [[WP:Set index]] articles are marked as disambiguation at WikiData... (maybe this isn't about WikiData, but I think I saw another post about it) [[User:Christian75|Christian75]] ([[User talk:Christian75|talk]]) 10:39, 18 May 2023 (UTC) ::No, we are not currently using wikidata. That was an option explored at [[Module:Disambiguation]] but it seems not worthwhile. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 10:42, 18 May 2023 (UTC) == Detecting pages with [[Template:Wiktionary redirect]] and other soft redirects == {{moved from|Template talk:Class mask}} @[[User:PARAKANYAA|PARAKANYAA]] suggested at [[Wikipedia talk:Content assessment]] that we should automatically detect pages using [[Template:Wiktionary redirect]] and its redirects, and automatically classify them as redirects. It seems we could the same with [[Template:Soft redirect]] and its redirects. Are there any other relevant templates? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 22:16, 9 January 2024 (UTC) :@[[User:MSGJ|MSGJ]] I think all the templates are listed at [[Wikipedia:Wikimedia sister projects#Specialized soft redirect templates]]. [[User:PARAKANYAA|PARAKANYAA]] ([[User talk:PARAKANYAA|talk]]) 22:22, 9 January 2024 (UTC) ::Wow okay, and you can bet that each template has about 10 redirects, so that's quite a lot of searching in the page text — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 22:23, 9 January 2024 (UTC) :::Sorry D: [[User:PARAKANYAA|PARAKANYAA]] ([[User talk:PARAKANYAA|talk]]) 22:37, 9 January 2024 (UTC) ::::I have created [[Module:Pagetype/setindex]] and [[Module:Pagetype/softredirect]] in preparation. Are there any other types that we could auto-classify? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 21:07, 17 January 2024 (UTC) Code now ready for testing in [[Module:Pagetype/sandbox]]. Some tests can be seen at the bottom of [[Template:Pagetype/testcases]]. If {{ul|Mr. Stradivarius}} was more active, I might ask him to check my code. My intention is to remove the call to [[Module:Disambiguation]] altogether as the code is mostly duplicated — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 22:34, 19 January 2024 (UTC) :{{ping|MSGJ}} Could you also add test cases to [[Module:Pagetype/testcases]]? There should be test cases there as well so that future updates to the code don't break the functionality you are adding. I designed the test cases so that you can specify an arbitrary "group name" (just a short description of the general kind of thing the test is testing), the arguments to the template, and the expected result. If you add more tests like that to the <code>tests</code> table they should just work. Also, please add any titles you use in the tests to the <code>mMockTitle.registerMockTitles</code> call at the top of the test cases and mock any fields that you will use. This ensures that the tests won't break if someone edits the actual wiki page in the future. You can see [[Module:Mock title]] for the different options you can use, but probably I guess you just need to copy the entry for "Alien" (a disambiguation page) and change the content. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 00:26, 20 January 2024 (UTC) ::Sure, will look at that. Can I ask a question? I assume that lines 25-27 of [[Module:Disambiguation]] are not needed here because we are already checking for redirects in line 210. Also, why are you using <code>mRedirect.getTargetFromText(content) ~= nil</code> rather than just <code>luaIsRedirect</code> in there? ::And if this works out well, can we get your bot to update these lists like it currently does for the dab pages? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 12:30, 20 January 2024 (UTC) :::{{tq|I assume that lines 25-27 of [[Module:Disambiguation]] are not needed here because we are already checking for redirects in line 210.}} Yes, that looks right to me. We shouldn't need a duplicate check. {{tq|1=Also, why are you using <code>mRedirect.getTargetFromText(content) ~= nil</code> rather than just <code>luaIsRedirect</code> in there?}} I don't remember the reason I wrote it that way. Maybe something to do with double redirects? There was definitely something that you had to parse the content for, rather than just checking the title object, but I don't remember the details, and I'm not sure if it still applies today. {{tq|And if this works out well, can we get your bot to update these lists like it currently does for the dab pages?}} Yes, it should be fairly easy to adapt (especially if we use the same format for all the data pages), and I would be willing to run it on the additional pages. Best — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 16:24, 20 January 2024 (UTC) :::Also, one thing I noticed about the code - you can add a <code>break</code> statement after [[Special:Permalink/1197292991#L-142|line 142]], which will stop the algorithm checking all of the templates on a page if it finds a match. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 16:28, 20 January 2024 (UTC) ::@[[User:Mr. Stradivarius|Mr. Stradivarius]] for some reason when I added [[Module:Pagetype/testcases#L-44]] as a mock title, suddenly 7 unrelated tests failed. They seem to be all the tests which do not specify the page name. All my new tests are working correctly. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 21:47, 21 January 2024 (UTC) :::{{ping|MSGJ}} This indicates a bug somewhere, but I don't have time right now to look through the code to find out where it is. I might have another look tomorrow. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 16:15, 22 January 2024 (UTC) ::::Okay thanks. I suspect a bug in [[Module:Mock title]] rather than this module — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 16:38, 22 January 2024 (UTC) :::::{{ping|MSGJ}} I found the issue. You added the string <code><nowiki>{{Soft redirect|meta:Wikipedia usage statistics}}</nowiki></code> to [[Module:Pagetype/testcases]], and as the module treats [[Module talk:Pagetype/testcases]] as the current page, it looks through the content of [[Module:Pagetype/testcases]], finds that string, and assumes that the module must be a soft redirect. This wasn't a problem with disambiguation templates as the check for those was limited to the main namespace, but soft redirect detection is done in every namespace. <p>I'm in two minds as to how to fix this. The obvious way would be to also check the page's content model before doing the template check, but checking the content model [[mw:LUAREF#Expensive properties|increments the expensive function count]] for pages other than the current page, which might cause problems in templates that depend on this module. The alternative is to exclude namespaces that typically have different content models, like module space, <del>and userspace JS/CSS pages</del>. This will be more of a pain to code and will be wrong for pages that have their content model changed manually, but it will avoid breaking dependent templates. I think the latter solution will be better, as I think there is a high probability of pages being broken by the increase in expensive function count if we choose the former. (This is just an assumption, however; I haven't checked in detail.)</p> <p>While I am thinking about it, there is also a similar problem with {{tag|nowiki}} tags; it is possible to write {{tag|nowiki|content={{soft redirect}}}} on a wiki page, and this will not be parsed as a soft redirect, but this module will treat it as one. To avoid false positives in discussions etc. where people are talking about soft redirects, we should also detect whether template invocations are contained in {{tag|nowiki}} blocks or not. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 07:15, 23 January 2024 (UTC)</p> ::::::Actually, userspace CSS/JS pages should not be excluded, as they are actually categorised if you add a comment like <code><nowiki>/* {{soft redirect}} */</nowiki></code> to them. If I remember correctly, this is behaviour from before content models were added to MediaWiki; the ability to categorise JS/CSS pages was briefly removed, but enabled again after users complained. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 07:29, 23 January 2024 (UTC) ::::::I added two new test cases and updated the rest of the tests to make it more obvious what is causing the test failures. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 08:14, 23 January 2024 (UTC) ::::::Thanks for looking into this. Alternatively we could just restrict the soft redirect detection to mainspace. I think we may be opening a can of worms by trying to ignore code like nowiki which deactivates the template. There are numerous other ways it can be done, e.g. with pre tags or HTML comments. Sounds like a coder's nightmare! — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:04, 23 January 2024 (UTC) :::::::I have another suggestion. We can use the size of the page to determine whether it is likely to be soft redirect. I would suspect anything greater than 1000 bytes is extremely unlikely to be a soft redirect. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 21:51, 24 January 2024 (UTC) ::::::::{{ping|MSGJ}} I had a go at stripping out nowiki, pre, syntaxhighlight and source tags, as well as HTML comments. The code is in the sandbox, and the tests are all passing now. The parsing isn't perfect, but it should work for 99% of cases. Are there any other tags or markup that we should filter out? — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 09:14, 25 January 2024 (UTC) :::::::::Wow, okay. No I can't think of any others. Can I just check if <code><nowiki><!--xxx-->{{soft redirect}}<!--xxx--></nowiki></code> will be detected or will it be greedy and ignore everything between the first open and last close? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:20, 25 January 2024 (UTC) :::::::::To avoid reinventing the wheel, you might look at [[Module:Wikitext Parsing#PrepareText]] — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:31, 25 January 2024 (UTC) ::::::::::I've added this to the sandbox and the testcases seem to be working okay — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 15:17, 31 January 2024 (UTC) ::::::::::{{done}} — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 20:26, 31 January 2024 (UTC) :::::::::::@[[User:MSGJ|MSGJ]] On the initial example I used, [['Murica]], it seems to have had a... strange result. The shell now ''says'' redirect, but still classifies as unassessed and the shell doesn't show the redirect icon. If I'm missing something, sorry. [[User:PARAKANYAA|PARAKANYAA]] ([[User talk:PARAKANYAA|talk]]) 22:22, 31 January 2024 (UTC) ::::::::::::Yes I think I might need to update [[Module:Class mask]] and/or [[Module:Banner shell]] as well — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 22:27, 31 January 2024 (UTC) ::::::::::::Working now I think @[[User:PARAKANYAA|PARAKANYAA]] — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 12:48, 1 March 2024 (UTC) :::::::::::::@[[User:MSGJ|MSGJ]] Thank you very much :) [[User:PARAKANYAA|PARAKANYAA]] ([[User talk:PARAKANYAA|talk]]) 21:16, 1 March 2024 (UTC) {{ul|Mr. Stradivarius}} when you have a chance, can you get your bot working on [[Module:Pagetype/setindex]], [[Module:Pagetype/softredirect]] and [[Module:Pagetype/disambiguation]]. Maybe look at moving [[Module:Disambiguation/templates]] over? Thanks — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 20:28, 31 January 2024 (UTC) :Filed a BRFA [[Wikipedia:Bots/Requests for approval/StradBot 2|here]]. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 03:24, 17 February 2024 (UTC) :Also, I don't think moving [[Module:Disambiguation/templates]] is necessary, as it is also being used in [[Module:Disambiguation]]. The situation now seems fine to me. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 03:27, 17 February 2024 (UTC) ::I guess I was wondering if [[Module:Disambiguation]] was still needed, given how we have moved most of its functionality here? It might make sense to move the isDisambiguationPage function to [[Module:Pagetype]] to avoid duplication of code. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 12:48, 1 March 2024 (UTC) == Recent change causing some problems with reports and bot actions == I am unable to find the discussion that led to [https://en.wikipedia.org/w/index.php?title=Module%3APagetype&diff=1202783627&oldid=1201502469 this change], but it may be causing [[Wikipedia_talk:Database_reports#Wikipedia:Database_reports/Unused_templates_(filtered)_update_related_to_Module:Pagetype|problems with reports]] and [https://en.wikipedia.org/w/index.php?title=User_talk:Legobot&curid=17932426&diff=1207949444&oldid=1206725690 bot actions]. {{U|Plastikspork}}, do you have a link to the discussion? – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 04:07, 16 February 2024 (UTC) :It's at [[User talk:MSGJ#Module:Pagetype]] — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:18, 16 February 2024 (UTC) :: [[User:Jonesey95|Jonesey95]], that change should have reduced transclusions, by eliminating some transclusions of non-existing pages. But, the change right before it may have increased transclusions. Thanks! [[User:Plastikspork|Plastikspork]] [[User talk:Plastikspork|<sub style="font-size: 60%">―Œ</sub><sup style="margin-left:-3ex">(talk)</sup>]] 15:04, 16 February 2024 (UTC) :::All I know is that the database report changed on the day after the second edit to this module. I know there are sometimes delays, but usually the simple explanation is the one to look at. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 16:31, 16 February 2024 (UTC) == Request update of Module:Pagetype/setindex (18 February 2024) == {{edit fully-protected|Module:Pagetype/setindex|answered=yes}} Bot comment: StradBot has detected that [[Module:Pagetype/setindex]] needs to be updated. This is due to a template being added or removed from [[:Category:Set index article templates]], or to a redirect to one of those templates being added or removed. The bot has saved the new page content in [[Module:Pagetype/setindex/sandbox]] ([https://en.wikipedia.org/w/index.php?title=Special:ComparePages&page1=Module%3APagetype%2Fsetindex&page2=Module%3APagetype%2Fsetindex%2Fsandbox diff]). Please review this and update the module if necessary. [[User:StradBot|StradBot]] ([[User talk:StradBot|talk]]) 16:07, 18 February 2024 (UTC) :Note: the [https://en.wikipedia.org/w/index.php?title=Module:Pagetype/setindex/sandbox&diff=cur&oldid=prev last sandbox edit] should be easier to read than the diff between the sandbox and the main module. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 16:14, 18 February 2024 (UTC) :: {{ping|Mr. Stradivarius}} This added [[Template:Infobox family name/doc]] to the list of templates, which is clearly wrong. It was previously a redirect with content, which may have caused confusion, and I've now replaced it with a bare redirect. [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 16:58, 18 February 2024 (UTC) :: It also added [[Template:family name]], a redirect to [[Template:infobox name]], which is used on pages like [[Smith (surname)]] that are clearly not set indices. Those seem to be the only two additions, neither of which is useful IMO, so {{not done}} [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 17:02, 18 February 2024 (UTC) ::: {{ping|Pppery}} Thanks for looking into this. I'll think of the best way to address this tomorrow. Could you also check if [[Module:Pagetype/softredirect/sandbox]] ([https://en.wikipedia.org/w/index.php?title=Module:Pagetype/softredirect/sandbox&diff=prev&oldid=1208716631 diff]) looks OK? There was a Pywikibot issue preventing me from saving the edit request for that page, but the module sandbox itself was saved successfully. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 17:11, 18 February 2024 (UTC) :::: Sorry, no. I see nonsense like [[Template:Barcelona Metro line 10]] and [[Template:Taxonomy/Olindiasidae]]. I would also weakly prefer to exclude templates like [[Template:Soft redirect with Wikidata item]] from the list, since they indicate the page is already a soft redirect because of another template rather than itself making the page a soft redirect, but if that's not possible to code up I would be fine with adding them. [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 17:17, 18 February 2024 (UTC) ::::: I fixed the bot - the issue was that I was using Pywikibot's BasePage.backlinks method instead of the BasePage.redirects method. There are more details [https://github.com/mrstradivarius/stradbot/issues/1 on GitHub]. [[Module:Pagetype/softredirect/sandbox]] should also be improved, but the Pywikibot issue that prevented me from saving the second edit request is still occurring, so the bot failed to leave an edit request for it; I will also need to get that fixed before finishing the trial. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 16:04, 20 February 2024 (UTC) == Request update of Module:Pagetype/setindex (20 February 2024) == {{edit fully-protected|Module:Pagetype/setindex|answered=yes}} Bot comment: StradBot has detected that [[Module:Pagetype/setindex]] needs to be updated. This is due to a template being added or removed from [[:Category:Set index article templates]], or to a redirect to one of those templates being added or removed. The bot has saved the new page content in [[Module:Pagetype/setindex/sandbox]] ([https://en.wikipedia.org/w/index.php?title=Special:ComparePages&page1=Module%3APagetype%2Fsetindex&page2=Module%3APagetype%2Fsetindex%2Fsandbox diff]). Please review this and update the module if necessary. [[User:StradBot|StradBot]] ([[User talk:StradBot|talk]]) 15:38, 20 February 2024 (UTC) :This edit wouldn't change the content of the setindex module, only the order and the formatting. As it would only be a cosmetic edit, I am deactivating this edit request. Future bot runs will only leave an edit request if the sandbox version changes, so no other action is necessary. The bot will leave its next edit request when the sandbox needs updating (i.e. when any of the templates in [[:Category:Set index article templates]] or their redirects change). — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 15:57, 20 February 2024 (UTC) == Protected edit request on 21 March 2024 - Improve execution time == {{edit fully-protected|Module:Pagetype|answered=yes}} Improves the execution time of this module by about 2 to 3 times by merging repeat calls to some intensive functions and calculating all templates once to avoid excessive calls to gmatch/ustring. Quite important for [[Module:WikiProject banner]], which has started to rarely hit the lua timeout error from time to time on large pages like [[Talk:List of common misconceptions]], with a significant amount of the execution time being this module. No change to any output or functionality (passes all testcases). [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 21:58, 21 March 2024 (UTC) :Temporarily disabled since I intend to make further changes. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 12:27, 22 March 2024 (UTC) ::Re-activated the edit request. Now has better performance in extremely specific circumstances and also fixes a bug in parseContent where explicitly not allowing soft redirect/sia/dab would not work and would revert to giving the default (this bug existed before my changes, there was just no testcase for that specific case). [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 17:30, 22 March 2024 (UTC) :{{done}}<!-- Template:EP --> — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 19:28, 22 March 2024 (UTC) == Pages under discussion == When a redirect is proposed for deletion, it stops being detected as a redirect. Would it be possible to fix this, perhaps by looking for the literal text #REDIRECT on the page? There might be other cases, e.g. disambiguation pages too — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 11:47, 3 May 2024 (UTC) :{{ping|MSGJ}} Currently we just check if the title object itself considers the page a redirect for calculating that. Searching for just the literal string <code>#REDIRECT</code> by itself would be a bad idea (this page itself would pick up if we did that), and searching for #REDIRECT in the correct context probably wouldn't be a great idea for the same reason (easy to false flag). If the only issue is redirect pages that are under discussion, the simplest solution would be to just add a check for the RfD template onto the existing parseContent system, which shouldn't be difficult to implement. Does that sound like it'd fix your issue? Also, I'm unsure what you mean when you reference disambiguation pages. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 21:33, 5 May 2024 (UTC) ::Yes, that should work. I think the code to look for would be <code><nowiki>#invoke:RfD</nowiki></code>. Forget about dab pages, wasn't thinking straight. Thanks — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 20:00, 6 May 2024 (UTC) :::I've made changes in the sandbox and created [[Module:Pagetype/rfd]], and it should be ready for proper testing (I've only done simplistic testcases so far). If everything works, then this is fine to move to live, since there's no other parts needed. The output of it can be controlled by setting the <code>|rfd=</code> parameter and by default it returns <code>redirect</code>. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 22:42, 6 May 2024 (UTC) ::::On second thought, it would probably be more intuitive if rfds followed the same classification as a regular redirect if <code>|redirect=</code> is used instead of having a seperate param (<code>|rfd=</code>) for this very specific case, so I've changed that to be the case instead. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 22:59, 6 May 2024 (UTC) :::::All looks good to me. Thanks for your help — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 07:52, 7 May 2024 (UTC) :::::I've deployed this, thanks again! — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 08:52, 9 May 2024 (UTC) == Subpages of talk pages == Subpages in Main talk space are currently classified as articles but their respective subject page is not an article, it usually doesn't exist (e.g. [[Talk:Multiverse (Marvel Cinematic Universe)/FAQ]]). It is not clear how we should classify them but they should probably return "page" instead of "article" — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 07:55, 7 May 2024 (UTC) :Had a play around but not sure how to achieve this. Detecting whether it's a subpage does not work because we are usually looking at the subject page not the talk page. Checking the existence of the page would work, but I don't really want to add an expensive parser function to every call of this module ... — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 20:58, 7 May 2024 (UTC) :[[AC/DC]] is an article but [[Multiverse (Marvel Cinematic Universe)/FAQ]] is not an article — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 21:00, 7 May 2024 (UTC) ::I agree with wanting to avoid adding an expensive call to every use, however it turns out the check for <code>title.isRedirect</code> in <code>detectRedirects</code> (the first check done) is already expensive, so this might not be an issue. Still thinking of a nice way to solve this issue, but nothing's come to mind yet. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 21:20, 7 May 2024 (UTC) :::Can <code>title.isSubpage</code> help here (with maybe checking <code>title.inNamespace</code> with it)? [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 07:20, 8 May 2024 (UTC) ::::I don't think so, unfortunately. I created [[Module:IsSubpage]] to test this. ::::* <code><nowiki>{{#invoke:IsSubpage|main|page=Multiverse (Marvel Cinematic Universe)/FAQ}}</nowiki></code> produces {{#invoke:IsSubpage|main|page=Multiverse (Marvel Cinematic Universe)/FAQ}}, because it's in mainspace which can't have subpages. ::::* <code><nowiki>{{#invoke:IsSubpage|main|page=AC/DC}}</nowiki></code> produces {{#invoke:IsSubpage|main|page=AC/DC}}, ditto. ::::* <code><nowiki>{{#invoke:IsSubpage|main|page=Talk:Multiverse (Marvel Cinematic Universe)/FAQ}}</nowiki></code> produces {{#invoke:IsSubpage|main|page=Talk:Multiverse (Marvel Cinematic Universe)/FAQ}}, which is correct. ::::* <code><nowiki>{{#invoke:IsSubpage|main|page=Talk:AC/DC}}</nowiki></code> produces {{#invoke:IsSubpage|main|page=Talk:AC/DC}}, which is basically a bug in MediaWiki software. ::::The best solution I can think of, is to use <code>title.exists</code> when the talk page title looks like it ''might'' be a subpage. If it doesn't exist then it's probably not an article — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:29, 8 May 2024 (UTC) :::::Actually we can use <code><title.exists</code> if there is a forward slash anywhere in the title, and it's in mainspace — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 21:14, 9 May 2024 (UTC) :::::Suggested code [https://en.wikipedia.org/w/index.php?title=Module:Pagetype/sandbox&diff=prev&oldid=1223164223] makes all the testcases work — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 08:59, 10 May 2024 (UTC) ::::::Aidan, do you know if the title.exists is evaluated if the first condition is false? I am trying to avoid unnecessary expensive functions. If it is evaluated, then I will put it in a separate "if" block — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:05, 10 May 2024 (UTC) :::::::I can't read the exact code since im on phone right now, but if the statement is like <code>if A and B then</code> then B won't be evaluated if A is false/nil. The same logic applies in reverse for an or (B won't evaluate if A is anything other than false/nil). [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 09:08, 10 May 2024 (UTC) ::::::::Thanks. Yes you've guessed the situation correctly. But now I have read more, I think we don't need to worry about adding an expensive function. Because we have already called .isRedirect on the same page, so calling .exists will not increment the expensive counter again. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:10, 10 May 2024 (UTC) Deployed code. Now pages in mainspace which do not exist are not classified as articles — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 21:47, 12 May 2024 (UTC) Proposed improved code on the sandbox. Adds support for specific output for non-existent pages using a {{para|nonexistent}} parameter. This will allow {{tl|WikiProject banner shell}} to treat these pages slightly differently. I have also been doing some code simplification. Will not be deployed until I work out why [[Module talk:Pagetype/testcases|testcase 204]] is not working anymore. Seems to be a strange issue with the mock title code (because it works outside the testcases), but will keep playing — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 08:19, 15 May 2024 (UTC) :[[Special:Diff/1223642991]] appears to be the change that broke it, though I'm struggling to figure out why and I won't be able to test further until later on. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 09:34, 15 May 2024 (UTC) ::Ok, perhaps the issue may be the mock titles. It appears that when the code grabs <code>title.subjectPageTitle</code> in <code>getTitle</code>, this title will be the real one, regardless of if a mock title was defined for that name. Whether or not this is the issue thats failing the test case I'm not too sure, but I wouldn't be surprised if it was. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 14:06, 15 May 2024 (UTC) :::The <code>patchTitleConstructors</code> function of [[Module:Mock title]] is supposed to take care of this, but I don't know enough about it. It seems to work okay in every other namespace though. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 14:09, 15 May 2024 (UTC) ::::Other namespaces are still broken, its just it appears them returning "page" due to not existing (even if we said they actually do) appears to still be valid for the given testcases. It's just this specific TimedText case where we start seeing bad behaviour. <code>patchTitleConstructors</code> doesn't currently hook the xyzTitle properties, so this is just missing functionality. I can try implement it, but it might take a bit to work out. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 14:16, 15 May 2024 (UTC) :::Hang on. That is actually the only page which does not exist in reality. In which case, could it true that the mock titles have never worked properly? But then why does 205 work? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 14:17, 15 May 2024 (UTC) ::::Since 205 has the ability to be classified by it being a talk page, pagetype runs through its logic using the talk page title instead of the subject page title. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 14:21, 15 May 2024 (UTC) :::::Well, I'm astounded that @[[User:Mr. Stradivarius|Mr. Stradivarius]] did not implement this correctly. For now I have replaced the tests with a TimedText page which does actually exist, and all tests are passing. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 14:26, 15 May 2024 (UTC) ::::::I've made an update to the mock title module in [[Special:Diff/1223977125]] which fixes this edge case of escaping mock titles, and the testcase now works as expected (Strad, if you do see this, maybe review this change, since the hooking is a little bit aggressive and it might have a better implementation). [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 14:34, 15 May 2024 (UTC) :::::::Maybe one day I'll understand what you did there. But for now, thanks — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 14:38, 15 May 2024 (UTC) :::::::This is a great start - thank you for the edit. One of the goals of the module is to be able to revert title objects to their original state after each test. To do this, I think you would need to keep track of each title object that is altered when being hooked. I will have a think about how best to do this. At the moment, I think normal title objects which have mock titles hooked in one of their properties will remain altered after the patching function exits. Also, a similar hooking process needs to be implemented for [[mw:LUAREF#Title objects|Title.subPageTitle( text )]], as that method returns other title objects. Best — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 15:25, 17 May 2024 (UTC) ::::::It's more "not yet implemented" than "not implemented correctly". Patches are welcome. :) — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 14:59, 17 May 2024 (UTC) == Interface messages == There are three different types of page in this namespace: # [[MediaWiki:Filetype-missing]] - valid message but has not been created to override default # [[MediaWiki:Duplicate-args-warning]] - has been created to override default # [[Mediawiki:Fghghghg]] - invalid and non-existent I notice that ifexist returns false on the first type. This is a valid message and a blue link, containing the default text for this message. You would only create it to overridge that default. I think I would prefer pagetype to identify this as an interface page rather than a non-existent page. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 14:32, 17 May 2024 (UTC) :Perhaps <code>title.isLocal</code> can be used to distinguish between some of these types — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 15:01, 17 May 2024 (UTC) :Proposed amended code on sandbox. A valid system message will be treated as an interface page even if it does not exist locally — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 09:34, 20 May 2024 (UTC) Also added a fix for files hosted on Commons, which were being classified as non-existent pages. All testcases are now working, so will deploy this later — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 12:06, 21 May 2024 (UTC) == Sandbox page protection fix == {{Edit fully-protected|Module:Pagetype/sandbox|answered=yes|force=yes<!--not a TPER matter-->}} Could the template protection that got automatically applied to the sandbox be removed? Someone presumably accidentally included it in a major module, but this got quickly fixed and the transclusions have already dropped to just 37. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 21:16, 10 October 2024 (UTC) :{{done}} -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 22:36, 10 October 2024 (UTC) :Yes that was probably [[Template:WikiProject Cycling]] — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 10:46, 11 October 2024 (UTC) == Invalid pages == The module fails badly when {{para|page}} is set to an invalid page, e.g. <code><nowiki>{{pagetype|page=Talk:Talk:Granville Gee Bee Model A}}</nowiki></code> produces {{pagetype|page=Talk:Talk:Granville Gee Bee Model A}} — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 14:55, 10 November 2024 (UTC) :Because that title is a bad title (mediawiki refuses to resolve it, e.g. [[Talk:Talk:Test]] will not link), <code>mw.title.new</code> is returning nil. How you'd want to handle this in the context of page types I'm not sure (an error probably makes sense tbh). [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 15:01, 10 November 2024 (UTC) ::Why not just the same as any other non-existent page, e.g. <nowiki>Gjdeoofg</nowiki> does not cause an error — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 15:26, 10 November 2024 (UTC) :::That's just a page that doesn't exist. It's still a valid possible page and therefore has resolvable properties, like a subject title. Pages that e.g. stack namespaces (see [https://en.wikipedia.org/wiki/Talk:Talk:A]) or contain invalid characters like <code>></code> (see [https://en.wikipedia.org/wiki/Tempalte:%3E]) ''can't'' exist per the mediawiki software, so <code>mw.title.new</code> returns nil for them, since it doesn't make sense to resolve them. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 20:34, 10 November 2024 (UTC) ::::Okay fair enough. I actually didn't know that you couldn't create certain pages — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 21:11, 10 November 2024 (UTC) :::::It would be nice to handle the nil value gracefully, but the coding is beyond my skills. And FWIW, I have created pages with stacked namespaces in error in the past, during page moves. [[Template:Template:A]] is a valid page name, for example. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 13:41, 11 November 2024 (UTC) ::::::The graceful handling makes sense, I could sandbox that if no one else does. It seems that the namespace stacking is mostly only an issue if the first namespace is <code>Talk:</code>, since it would be the talk page of an impossible to resolve article, since it wouldn't be an article if it started with a namespace (for all other namespaces this doesn't appear to be an issue, e.g. [[Template talk:Talk:E]] can easily associate with [[Template:Talk:E]]). [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 13:51, 11 November 2024 (UTC) :::::::I've changed the sandbox such that the error at least points out the exact issue instead of just erroring later on (see [[Special:Permalink/1257015583|test page]]). [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 19:32, 12 November 2024 (UTC) ::::::::{{thumbsup}} Looks good — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 19:39, 12 November 2024 (UTC) == class parameter == In olden days, we had no way of detecting disambiguation pages and other types of page so we used to pass the {{para|class}} parameter to this module. I'm wondering if this is still needed now — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 18:02, 16 November 2024 (UTC) :As far as I can tell the functionality boils down to "if parameter 1 is <code>na</code> and the page is in mainspace, return <code>page</code> (or something custom) instead of <code>article</code>", and that's it. It does give me the vibe of an old hacky-ish fix that implemented na-rating handling possibly at a lower level than it should've been. It's hard to tell how in use it currently is without adding a category, but [https://en.wikipedia.org/w/index.php?search=hastemplate%3Apagetype+insource%3A%2F%5C%7B%5C%7B%5BPp%5Dagetype+%2A%5C%7C%5B%5E%7C%3D%5D%2B%5C%7C%2F&title=Special:Search&profile=advanced&fulltext=1&ns0=1&ns2=1&ns4=1&ns6=1&ns8=1&ns10=1&ns12=1&ns14=1&ns100=1&ns118=1&ns126=1&ns710=1&ns828=1&limit=500 this insource search] suggests it's still in use in quite a few templates (majoritively wikiprojects, some of which still have a lot of transclusions like {{tl|WikiProject Biography}} and {{tl|WikiProject Television}}), so a decent amount of initial conversion work would probably be required before removing it. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 21:46, 16 November 2024 (UTC) ::Yes, it's in [[Module:Banner shell]] but is causing unexpected results so I will be removing it shortly — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 21:52, 16 November 2024 (UTC)
Summary:
Please note that all contributions to LarpOfHoi4 Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LarpOfHoi4 Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Pages included on this page:
Template:=)
(
edit
)
Template:Central
(
edit
)
Template:Copied
(
edit
)
Template:Done
(
edit
)
Template:Edit fully-protected
(
edit
)
Template:Moved from
(
edit
)
Template:Not done
(
edit
)
Template:Oldid
(
edit
)
Template:Pagetype
(
edit
)
Template:Pagetype/sandbox
(
edit
)
Template:Para
(
edit
)
Template:Parameter
(
edit
)
Template:Pb
(
edit
)
Template:Permprot
(
edit
)
Template:Ping
(
edit
)
Template:Re
(
edit
)
Template:Tag
(
edit
)
Template:Template link
(
edit
)
Template:Template link expanded
(
edit
)
Template:Thumbsup
(
edit
)
Template:Tl
(
edit
)
Template:Tlx
(
edit
)
Template:Tq
(
edit
)
Template:Tracked
(
edit
)
Template:U
(
edit
)
Template:Ul
(
edit
)
Module:Arguments
(
edit
)
Module:IsSubpage
(
edit
)
Module:Pagetype
(
edit
)
Module:Pagetype/config
(
edit
)
Module:Pagetype/rfd
(
edit
)
Module:Pagetype/softredirect
(
edit
)
Module:Template link general
(
edit
)
Module:Wikitext Parsing
(
edit
)
Module:Yesno
(
edit
)
Search
Search
Editing
Template talk
:
Pagetype
Add topic