This Duplinks-alt (source) script highlights links that occur more than once in an article. It's derived from User:Ucucha's "duplinks" script. The first occurrence of a duplicated link will also be highlighted in a green dashed border. To account for exceptions to WP:REPEATLINK, this script considers only links that are within paragraphs (<p>...</p>
tags) and ignores any links inside an infobox or navbox. In addition, it highlights duplicate links within the lead and within the body of the article separately.
Installation
editTo install the script, add this line to your common.js:
{{subst:lusc|User:Evad37/duplinks-alt.js}}
Warning
editThis script and the original script should not be installed at the same time. If you already have the original installed, please remove the line
importScript('User:Ucucha/duplinks.js'); // [[User:Ucucha/duplinks]]
or deactivate it by placing two slashes (//
) at the start of the line.
Usage
editThere will be a link "Highlight duplicate links" in the toolbox on the left on every mainspace article, as well as userspace pages and draftspace pages. If nothing seems to happen, that probably means no duplicated links were detected.
Links will be highlighted in the rendered page text. If editing the page source, clicking Preview, followed by highlighting duplicates will show both the edit box, and the rendered text with duplicates highlighted—viewing and removing links will require some scrolling, or opening the article and highlighting duplicates in another browser tab, switching between tabs. Possibly the easiest way to remove duplicates is with the visual editor; when visual-editing a page, duplicate links can be highlighted; left-click on an unwanted link, then click the "unlink" icon (two links of a chain, crossed out, in red) in the box that pops up. (To re-create or insert a link, highlight the text and click the chain icon above the text box; if the link was piped the re-created link will need editing.)
As of October 2019[update] unlinking any link in the visual editor removes the highlight from the remaining duplicated links in that paragraph.