User:FlightTime/SortCats

This script allows you to sort a page's categories alphabetically. It is based off a similar script by Epicgenius. First, navigate to any page with at least one…

User:FlightTime/SortCats
User script
SortCats
Page categories sorted alphabetically
DescriptionThis script allows you to sort a page's categories alphabetically
AuthorsFlightTime (customized)
Epicgenius (original)
Status
Release
Updated03/25/25
BrowsersChrome, Not sure about others
SkinsVector, Not sure about others
Source
Beta
User:FlightTime/SortCats.js
User:Epicgenius/sortcategories.js

This script allows you to sort a page's categories alphabetically. It is based off a similar script by Epicgenius. First, navigate to any page with at least one category in the wikitext itself. If you have source editor enabled, click "edit" (or "edit source" if you also have VisualEditor enabled), and press the "Sort categories" button in the left sidebar, under "Tools". Upon clicking the button, the script will sort categories alphabetically. Categories with the same name as the article's title will be sorted first, and categories starting with "A [..]", "An [..]", or "The [..]" being sorted according to their second word.

There are a few key differences between this script and Alex 21's script:

  • This script will sort categories starting with "A", "An", or "The". Alex 21's script only sorts categories beginning with "A" or "The".
  • This script automatically shows a diff of your changes after you use it.
  • If there is a {{DEFAULTSORT}} magic word on the page, this script will remove any blank lines between the DEFAULTSORT and the first category. The DEFAULTSORT magic word should be before the categories.
  • If there are any stub tags on the page, this script will add two blank lines between the last category and the stub tag, as per WP:TAGSTUB: Leave two blank lines between the first stub template and whatever precedes it. (One blank line leaves the stub category notice butted up against any preceding navigation template, it takes two blank lines in the edited text to produce one blank line in the displayed text.) The stub tags should be after the categories.

Installation

To use this script: Copy the line below, then click here, paste the line, and click Save page.

importScript('User:FlightTime/SortCats.js'); // [[User:FlightTime/SortCats.js]]

Finally, clear your cache and you're set to go.

Issues

Please post issues or concerns on the talk page. Please include {{ping|FlightTime}} with your post.

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.