FANDOM


Linksweeper removes backlinks (links, templates, files, and categories) from pages listed in special pages such as Special:Wantedpages, Special:Whatlinkshere, and Special:Wantedfiles. It also allows clean-up of links entered in the dialog box.

Important Note: Be careful when cleaning up categories. Due to the way links are created this script will also remove categories from pages, and not just their links (needs a fix at some point), e.g. [[Category:Sweepy]] and [[:Category:Sweepy]].

Usage

Configuration

linkSweepConfirmation = true;
LinkSweeperDelay = 1000;
Using configuration options with FANDOM Open Source Library scripts
The instructions on this page describe how to use configuration options with a script. Here on the FANDOM Open Source Library, many scripts provide optional configuration settings as a mean to alter or enhance the default behavior of the script. When installing configuration options in your JavaScript file, please note that they need to go above the import statement in order to work — unless the directions say otherwise. In case MediaWiki:ImportJS is used to load the scripts, it will be executed last.
Configuration options load too late, don't work
Proper placement of configuration options
// 1. AjaxRC import statement
importScriptPage('AjaxRC/code.js','dev');
 
// 2. AjaxRC configuration option
var ajaxRefresh = 30000;
// 1. AjaxRC configuration option
var ajaxRefresh = 30000;
 
// 2. AjaxRC import statement
importScriptPage('AjaxRC/code.js','dev');

Features

  • Removes templates, file links (including from gallery), and normal links
  • Pulls in links to remove from special pages or category
  • Shows backlinks in the modal (popup) from any page
  • Toolbar link
  • Button to fetch all redlinks in a page

Instructions

Click "remove backlinks" button on Special:WantedPages or Special:Whatlinkshere. One can also change some script settings by putting the options before the importarticles:

window.linkSweepConfirmation = true; 
window.linkSweeperDelay = 1000; //milliseconds
window.linkSweeperRedlist = {"wantedpages" : 1};
window.categoryList = [];

LinkSweepConfirmation adds a confirm dialog before attempting to remove the links, set true to show this dialog always. LinkSweeperDelay is the number of milliseconds before the next removal, this prevents flooding the wiki with too many requests.

The category allows users to add custom categories to fetch links to clean, e.g. :

window.categoryList = ["myfavcat", "spam"]

The linkSweeperRedlist consists of pages where the link sweeper will show up the to help remove links. It can be configured to work in additional special pages by adding the canonical name of a special page. However, it has only been tested with the default special pages (the ones below), and may not work in others. To use this configuration add each name as in the example below (canonical name in quotes, followed by colon and "1" , followed by a comma):

window.linkSweeperRedlist = {
      "wantedpages": 1,
      "whatlinkshere": 1,
      "wantedfiles": 1,
      "listredirects": 1,
      "uncategorizedpages": 1
}

Completely removing a link

By default the scripts only removes the square brackets from the link. However, there is a checkbox "delete links?" that enables a more aggressive mode, and completely removes the link from a page:

  • Normal mode - Replaces a link like [[Bazooka]] with "Bazooka"
  • Delete mode - Replaces a link like [[Bazooka]] with "" (empty text)

Notes

  • It will only check a max of 500 backlinks.
  • It will not work on links constructed by templates or lua modules.
  • It will automatically append "--<nowiki>" to the module namespace to eliminate those invalid reports.

History

  • 2016/05/05 Added button to fetch all redlinks in a page and improved template detection
  • 2016/04/16 Added custom list of categories to fetch pages
  • 2016/04/01: Added support for cleaning templates, added category button, button for batch removal in special pages
  • 2016/03/17: Added support for cleaning links in galleries
  • 2016/03/16: Added support for removing many links at once, added show backlinks button
  • 2016/03/12: Added Link to Wikia oasis skin (mytools) and "?action=delete"
  • 2016/03/10: Bug fix (normalize page titles: compare spaces, colon trick
  • 2016/03/09: Bug fixes and new features (arbitrary link page, custom summary, support for Special:Wantedfiles, namespace, delete & de-link)
  • 2016/03/05: Initial commit

See also

Start a Discussion Discussions about Linksweeper

  • Request for Link Removal Script

    59 messages
    • Colouratura wrote: ideally you can test it by copy pasting it into your console To import it permanently you'd need to add it directly...
    • That did nothing, I'm getting the exact same error.