User:Ucucha/HarvErrors

Harvard citation templates like Sfn are prone to problems with their automatically generated links (see for an extreme example). User:Ucucha/HarvErrors.js (based on User:Svick/HarvErrors.js) checks these links for validity and displays an error message for incorrect links. In addition, it checks for citations that are set up to receive links, but do not have any pointing to them.

For example, the following code produces an incorrect link and a citation without anything pointing to it: Text

Installation and customization
To install the script, add:

to Special:MyPage/common.js.

If installed correctly, you will see a red error message in this note

If you don't see an error message, you may still need to bypass your cache.

Hiding "There is no link pointing to this citation" messages
The check for full citations that have no associated short citations pointing to them is a warning that often requires no action because full citations do not always need short citations. For example, the citation may be in a "Further reading" section, or Harvard citations may not be used in an article. To disable warnings that a long citation is present without a corresponding short citation, add the following to Special:MyPage/common.js, on a new line:

When reviewing articles, this means you will have to check manually that each full citation used as a source has a corresponding short citation, if appropriate.

Fixing problems
The problems caught by this script often have one of the following causes:
 * The work cited in the Harvard citation is not in the list of references. In this case, add e.g.  to the list.
 * The work cited is in the reference list, but has ref set to something other than the default  (which is set by all  and citation templates by default).
 * The author(s) or year in the Harvard citation and the citation in the reference list do not match exactly. For example, the spelling of one of the names may be incorrect, or the year in the short and full citations may not match.
 * A Harvard citation was copied from one article to another, but the matching full citation from the first article's reference list was not copied.