This section in a nutshell: Effective April 2020, CS1 templates (e.g. {{cite book}}, {{cite journal}}, and the other {{cite ...}} templates) behave like CS2 templates (e.g. {{citation}}) with respects to the generation of harvard-style anchors (see discussion). This means that adding |ref=harv to "long" CS1 citations is no longer required to use "short" citation templates like {{harvnb}}, {{sfn}}, and other {{harv}}-like footnotes.
If you see more yellow warnings like
than usual, those are caused by User:Ucucha/HarvErrors.js. To suppress/reduce these yellow warnings, you can use any of the following options
If there still are errors after this, see how to deal with harvard-style citation issues. The documentation might be a bit out of date, but every piece of advice listed for CS2 (e.g. {{citation}}) now applies to CS1 (e.g. {{cite book}}) as well. If none of those options satisfy you, you can make a new script request at WP:SCRIPTREQ. |
Harvard citation templates like {{Sfn}} are prone to problems with their automatically generated links (see [1] 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{{Sfn|Smith|2011|p=9}} {{reflist}} ==References== *{{cite book|last=Smith|first=John|year=2010|title=A Book|publisher=A Publisher}}
With the script installed, this looks as follows (if you already have the script installed, you will see duplicate messages):
Text[1]
- ^ Smith 2011, p. 9. Harv error: link from CITEREFSmith2011 doesn't point to any citation.
References
edit- Smith, John (2010). A Book. A Publisher. Harv warning: There is no link pointing to this citation. The anchor is named CITEREFSmith2010.
Installation and customization
editTo install the script, add:
importScript('User:Ucucha/HarvErrors.js');
If installed correctly, you will see a red error message in this note[1]
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
editThe 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:
window.checkLinksToCitations = false;
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
editThe 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.
*{{cite book |last=Smith |first=John |year=2010 ...}}
to the list. - The work cited is in the reference list, but has
|ref=
set to something other than the defaultharv
(which is set by all {{cite xxx}} 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.