User:Anne drew/FormatSeeAlso
Description | Formats "See also" sections per MOS:ALSO – annotates links, alphabetizes, and makes other improvements. |
---|---|
Author(s) | Anne drew |
Updated | October 1, 2025 (5 days ago) |
Source | User:Anne drew/FormatSeeAlso.js |
This userscript automatically formats "See also" sections according to MOS:ALSO. With a single click, it converts plain wikilinks to use the {{anl}}
template (adding short descriptions), properly formats section links with {{slink}}
, and optionally sorts links alphabetically. The script intelligently preserves your existing formatting choices like italics, quotes, and manual descriptions while respecting nested list structures.
The script handles various edge cases automatically – it skips disambiguation pages, non-mainspace articles, and links without available descriptions. For redirect links where the target page's description might not match the redirect's context, it presents a dialog letting you choose which ones to annotate. The script also recognizes special cases like pluralized links (e.g., converting [[example]]s
to the proper template format) and parenthetical abbreviations.
Credit and thanks to Guywan for the sorting logic from User:Guywan/Scripts/BulletSort.
![]() | You take full responsibility for any actions taken using FormatSeeAlso. You must read and understand all relevant Wikipedia policies and abide by them when using this tool; failure to do so may result in being blocked from editing. |
Installation
[edit]- Go to your common JavaScript and paste in the following line:
{{subst:iusc|User:Anne drew/FormatSeeAlso.js}}
- Save the page.
Usage
[edit]
Edit any article page with a "See also" section and click the purple "FSA" button in the toolbar. The script will guide you through three steps (detailed in the #Workflow section below):
- Step 1: Review missing descriptions - Add
{{Short description}}
templates to articles that need them - Step 2: Select redirects to annotate - Choose which redirects should use their target page's description
- Step 3: Sort lines - Optionally sort the links alphabetically per MOS:ALSO
Review your changes carefully, make any necessary manual adjustments, and save.
Example
[edit]Before:
* [[Page with no description]] * [[Number]] * [[Computer science#Algorithms]] * ''[[Animal Farm]]''
After:
* {{anl|Animal Farm|''Animal Farm''}} * {{slink|Computer science#Algorithms}} * {{anl|Number}} * [[Page with no description]]
Workflow
[edit]The script guides you through three steps to format your "See also" section:
Step 1: Review missing descriptions
[edit]Before formatting a "See also" section, the script shows a dialog listing links that are missing descriptions. This helps you identify and add short descriptions to articles before they're formatted with {{anl}}
templates.
Category | Description | Example | Action you can take |
---|---|---|---|
Articles missing descriptions | Direct article links without short descriptions | [[Quantum computing]] |
Add {{Short description|Field of computer science}} to the article
|
Redirects to sections missing descriptions | Redirects pointing to article sections where the redirect lacks its own description | [[Machine learning]] → [[Artificial intelligence#Machine learning]] |
Add {{Short description|Field of study in AI}} to the redirect page
|
Redirects to articles missing descriptions | Redirects where both the redirect and target article lack descriptions | [[ML]] → [[Machine learning]] |
Add descriptions to either the redirect or target article (or both) |
What the dialog shows
[edit]- Articles missing descriptions: Simple article links that would get
{{anl}}
templates but don't have short descriptions - Redirects to sections missing descriptions: Redirect pages that point to article sections but lack their own descriptions
- Redirects to articles missing descriptions: Redirect pages where both the redirect and its target lack descriptions
What the dialog excludes
[edit]The dialog intelligently filters out links that wouldn't be processed anyway:
- Missing articles (red links)
- Articles in wrong namespaces (like
[[Wikipedia:Policy]]
) - Disambiguation pages
- Links with manual descriptions (like
[[Article]] – Custom description
) - Quoted links (like
"[[Article]]"
) - Articles that already have
{{Short description|none}}
This ensures the dialog only shows actionable items where adding a description would improve the encyclopedia.
Step 2: Select redirects to annotate
[edit]The script intelligently handles redirects by presenting a dialog to choose which ones should be annotated with their target page descriptions. This helps ensure descriptions are appropriate for the redirect context.
Feature | Description | Example | Benefit |
---|---|---|---|
Manual selection | Presents dialog to choose which redirects to annotate with target page descriptions | "Money trail → Follow the money" shown for user selection | Ensures descriptions are appropriate for the redirect context |
Description-only filtering | Only shows redirects in dialog when target page has a description | "Canada (country)" appears in dialog (has a description), "List of Canadian restaurants" does not | Only prompts for redirects that can be formatted with {{anl}}
|
Target display | Shows where each redirect points | Dialog shows: "USA → United States" | Users understand what description they're adding |
The script also handles several redirect scenarios automatically without user intervention:
- Redirects that have their own short descriptions (like
[[Russian Monument (Liechtenstein)]]
) are automatically formatted with{{anl}}
since their descriptions are already appropriate. - Section redirects without their own descriptions (like
[[List of New Zealand monarchs]]
which redirects to[[Monarchy of New Zealand#List of monarchs]]
) are automatically skipped to prevent misleading descriptions from the target article being applied. - Redirects that differ only in capitalization or punctuation from their target page (like
[[Royal Succession Bills and Acts]]
redirecting to[[Royal succession bills and acts]]
) are automatically accepted without confirmation since they represent the same topic.
Step 3: Sort lines
[edit]After handling missing descriptions and redirect selection, you can optionally sort the links alphabetically per MOS:ALSO.
Feature | Example | Result | Explanation |
---|---|---|---|
Natural number sorting | "2 Fast", "10 Things", "100 Items" | Sorts as 2, 10, 100 | Numbers sort naturally, not alphabetically |
Quote normalization | "[[Canada]]" |
Sorts as Canada |
Ignores quotes for alphabetization |
Nested list preservation | * Parent ** Child |
Children stay with parents | Maintains logical groupings |
Case insensitive | "apple", "Apple", "APPLE" | Treated equally | Standard alphabetical ordering |
Technical details
[edit]The script automatically recognizes different link types and applies appropriate formatting rules:
Smart link recognition
[edit]Type | Example input | Output | Why it's useful |
---|---|---|---|
Section links | [[Article#Section]] |
{{slink|Article|Section}} |
Section links need special formatting per MOS:SECLINK |
Italicized titles | ''[[Animal Farm]]'' |
{{anl|Animal Farm|''Animal Farm''}} |
Book/film titles should remain italicized |
Manual descriptions | [[Article]], description |
Standardizes to en dash, capitalizes: [[Article]] – Description |
Ensures consistent formatting while preserving editor intent |
Quoted links | "[[Article]]" |
{{anl|Article|quote=yes}} |
Maintains quotation formatting in the template |
Display text preservation | [[United Nations|U.N.]] |
{{anl|United Nations|U.N.}} |
Maintains editor's intended display text |
Abbreviation support | [[United States]] (US) |
{{anl|United States|abbr=US}} |
Automatically detects parenthesized abbreviations and adds them to templates |
Agglutinated links | [[Allied Commission]]s |
{{anl|Allied Commission|Allied Commissions}} |
Preserves plural forms while adding descriptions |
What it WON'T touch
[edit]Skip condition | Example | Reason |
---|---|---|
Disambiguation pages | [[Mercury (disambiguation)]] |
Disambiguation pages don't need descriptions |
Trailing context | [[Link]] (see also...) |
Has contextual information after the link |
Existing templates | {{annotated link|Article}} |
Already properly formatted |
Non-mainspace | [[Wikipedia:Manual of Style]] |
Project pages don't have short descriptions |
Missing pages | [[Non-existent article]] |
Can't add descriptions to pages that don't exist |
No description available | Articles without short descriptions | Nothing to add via template |
Colon-prefixed | [[:Category:Science]] |
Category/file links have different purposes |