Template talk:Random page in category

Latest comment: 1 year ago by Paine Ellsworth in topic returntype

Some suggestions edit

I think we should add "<span class="plainlinks"></span>" around the content of this template so it doesn't get the external link icon.

And we could get a shorter URL if we use "toolserver.org" instead of "tools.wikimedia.de". Although the "tools.wikimedia.de" URL is nice since it tells where the toolserver is and that it belongs to Wikimedia, so I am not sure which is the nicest.

--David Göthberg (talk) 17:10, 10 December 2009 (UTC)Reply

Both done. I think it doesn't matter which domain name we use, so I changed it to “toolserver.org”. Svick (talk) 02:15, 11 December 2009 (UTC)Reply
It looks nice with the plainlinks. And right, it doesn't matter which domain is used. I just wanted to point out there was an alternative, and that the two domains mean the same server.
--David Göthberg (talk) 02:39, 11 December 2009 (UTC)Reply

Minor Suggestion edit

If someone who is good with templates could help me:

IF no parameter #2 is given, then use [[Special:Random/Categroy:<Name of Category here>|Random article]]

That way is faster and more efficient. Thanks!

Tim1357 (talk) 16:04, 21 February 2010 (UTC)Reply

But that doesn't work. E.g. clicking on Special:Random/Category:Mathematics doesn't take you to random article in that category. Svick (talk) 07:55, 22 February 2010 (UTC)Reply

Support on Wikia edit

Hello, I was wondering if it is possible for this tool to work on wikia. I see that it is not on the list of supported sites, but is there a technical reason why it is not on there? Thank you, 164.116.126.145 (talk) 16:36, 7 April 2010 (UTC)Reply

This templates uses a tool on the Toolserver. The Toolserver is meant to be used for tools for Wikimedia projects, and Wikia isn't one of them. Svick (talk) 17:35, 7 April 2010 (UTC)Reply
So there is absolutely no way to get this to work on wikia? Does anyone by chance have the source code for this page? 164.116.126.145 (talk) 18:49, 7 April 2010 (UTC)Reply
I created a very simple substitution for Wikia: http://svick.org/WikiaRPIC.aspx. It doesn't go into subcategories of selected category, but I could add that, if you wanted. Svick (talk) 21:15, 7 April 2010 (UTC)Reply

How to use; publicity edit

How can one use this? I would like to get random articles in a particular field, but how do I do it?

I only stumbled on this function. I'm sure if I'd been searching for it, I never would have found it. Like most Wik functions, it is not well publicized. Please let people know about this function.Kdammers (talk) 01:33, 18 April 2010 (UTC)Reply

See the examples: e.g. if you want to get a random article from Category:Physics, its subcategories, or their subcategories, use {{Random page in category|Physics|2}}, which produces Random page in category Physics.
Where do you think should it be publicized? Or, where would you search for it?
Svick (talk) 11:56, 18 April 2010 (UTC)Reply

Problem with secure login edit

This template always takes me to en.wikipedia.org. I'd like to stay on secure.wikimedia.org if that's where I'm starting from. Is there any way to fix that? Thanks, Bovlb (talk) 20:12, 2 December 2010 (UTC)Reply

I've fixed my own problem by installing a browser extension, but it would still be nice to fix it for all users. Bovlb (talk) 20:23, 2 December 2010 (UTC)Reply
This template uses a toolserver tool that doesn't seem to support the secure server. You'd have to ask its author to add that and it could be then added to this template. Svick (talk) 23:16, 2 December 2010 (UTC)Reply

No longer working edit

It says that it no longer works on the English Wikipedia. What's with that? Is this temporary, because if not, there should be a replacement.--Zzyxzaa26 (talk) 18:31, 14 September 2011 (UTC)Reply

I've re-enabled the tool. Please see m:User_talk:Erwin#Broken_tool for more information. --Erwin (talk) 18:36, 21 September 2011 (UTC)Reply

New tool edit

I just created a simple variant of my random article tool: tools:~erwin85/randomarticle.simple.php. This tool uses less resources and is probably more suitable for most categories here. When the original tool takes too much time I suggest using this tool. Perhaps it's even better to use the simple instead of original tool in this template. They basically do the same thing but the original tool tries to exclude disambiguation pages, supports multiple categories and supports subcategories. The simple tool doesn't. --Erwin (talk) 10:25, 16 October 2011 (UTC)Reply

Write out random title edit

I think it could be interesting to have a random title appear rather than the "random page in category" text. It would allow us to populate a list of examples like so:

Which would like like this:

84.106.26.81 (talk) 14:14, 1 January 2012 (UTC)Reply

I think that wouldn't be possible, unless you used some custom JavaScript code. And I think that's not worth it. User<Svick>.Talk(); 09:38, 2 May 2012 (UTC)Reply

Replace with special page? edit

We now have Special:RandomInCategory, which does basically the same thing as this tool, but seems to be a lot faster. It doesn't support subcategories, however. Do people think it would be worth switching the template over to use it? — Mr. Stradivarius ♪ talk ♪ 02:00, 6 February 2014 (UTC)Reply

I'm going to go with don't fix it if it isn't broken unless the template is significantly faster...I'm a bit concerned that some of the uses of this template might be specifically taking advance of the subcategory functionality as well. DonIago (talk) 17:55, 18 February 2014 (UTC)Reply

Not a link template edit

In that case, it's no longer a Link templates. Dpleibovitz (talk) 07:56, 15 February 2020 (UTC)Reply

Including subcategories? edit

I'd like to use this template for a feature at the WP:Task Center, but it would require the ability to search through subcategories. I see from the history that that used to be available; is there any way to get it back? Sdkb (talk) 21:31, 25 February 2020 (UTC)Reply

Error message for empty categories? edit

I notice that, when using this template for an empty category, it just goes to Special:RandomInCategory. Could we get it to display an error message instead, saying "this category is empty"? Sdkb (talk) 03:33, 6 March 2020 (UTC)Reply

@Sdkb: The sandbox version will do exactly that. --Ahecht (TALK
PAGE
) 21:34, 6 June 2020 (UTC)Reply
Ahecht, awesome; thank you! If you've tested to make sure there aren't bugs, then I'm fine with implementation. Cheers, {{u|Sdkb}}talk 21:41, 6 June 2020 (UTC)Reply
I've spread the link around a bit, and am waiting to see how reliable that toolforge link is before doing a wide rollout. --Ahecht (TALK
PAGE
) 21:44, 6 June 2020 (UTC)Reply
@Sdkb:   Done --Ahecht (TALK
PAGE
) 20:37, 28 June 2020 (UTC)Reply

Default broken edit

Trying to follow the link from Category:All Wikipedia level-5 vital articles, it appears the behavior this used to have where it'd use the current page as a default if none is specified is broken. It appears there also used to be an unnamed second parameter. {{u|Sdkb}}talk 06:05, 20 November 2020 (UTC)Reply

Random page in article namespace edit

I thought of adding a random page in cathegory for mainspace (article) only pages link to Category:Pages_with_broken_reference_names. My attempt can be found at User:Personuser/sandbox, where some tests cn also be performed. The |ns parameter seems to work well for other namespaces, but to return also articles from different namespaces with |ns=0 (or |ns=article). I guess the problem is how the main namespace is defined (in this tool or in general), but I may be also be missing something trivial. Any suggestion for possible workarounds (excluding other namespaces seems an option) or different tools that could do the job are welcomed. Personuser (talk) 22:55, 10 April 2021 (UTC)Reply

Edit request to complete TfD nomination edit

Template:Random page in category has been listed at Templates for discussion (nomination), but was protected so could not be tagged. Please add:

{{subst:tfm|help=off|type=tiny|1=Random article}}

to the top of the page to complete the nomination. Thank you. TGHL ↗ 22:45, 7 May 2021 (UTC)Reply

  Done {{u|Sdkb}}talk 22:48, 7 May 2021 (UTC)Reply

Special page edit

I think we should change to special page. Also I have seen some problems pending this template, when the page don't go as expected. Thingofme (talk) 02:49, 14 February 2022 (UTC)Reply

returntype edit

I suggest to add a parameter "returntype" which "return the associated subject page if the randomly chosen page is a talk page" (from doc). I want to use it in the Good article categories. See Template:Random page in category/sandbox and Template:Random page in category/testcases (Test5). Christian75 (talk) 16:05, 10 June 2022 (UTC)Reply

Please replace the template with the content of the sandbox. See my first comment for reason, and link to testcase. Christian75 (talk) 08:56, 18 June 2022 (UTC) }} Christian75 (talk) 08:56, 18 June 2022 (UTC)Reply

  Done. P.I. Ellsworth , ed. put'r there 13:09, 18 June 2022 (UTC)Reply