Template:Copycat/doc

From Wikipedia, the free encyclopedia

The purpose of this template is to assist the creation new categories that have a year or year-range in their name, such as Category:2021 in Cambodian sport and Category:2021–22 rugby union standings templates. Such categories typically use a dedicated template, but to discover it one has to manually go to Category:2020 in Cambodian sport and copy the contents over to the 2021 version. This template aims to grab the contents of that sibling category automatically so that it can be easily pasted into the edit window of the 2021 category.

{{Copycat preload}} can be used in an URL to preload this template, and creating a link to that URL in one's sidebar makes it a one-click operation to bring up the contents of the sibling category.

Currently an alpha release - it has basic functionality but is not particularly robust.

Usage[edit]

Go to a category with a single year in its name that you want to create, put :

{{Copycat}}

in the Edit window and preview it. The template will then look for a sibling category, starting with the previous year and going back up to three years. If it finds a sibling category, it will display the contents of that category in the Preview, allowing an easy copy-and-paste into the edit window. (does anyone know how to display it properly in the edit window itself? Probably needs a double substitution or something???).

Even more convenient is the one-click solution found in User:Le Deluge/vector.js, which puts a link in the sidebar to an URL that preloads {{Copycat preload}} which calls Copycat. This turns the process of creating a year category into a single click on the sidebar followed by a copy-and-paste.

At present, the template is in a fairly rudimentary state. There's not much error correction and it relies on finding a {{title year}} or in the category's name, and then scans back up to three years. It returns the contents of the latest year, or all three "season" categories. It'd be nice to expand the functionality to include decades and centuries.