Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Help:Cite errors/Cite error references duplicate key

From Wikipedia, the free encyclopedia
<Help:Cite errors
This help page is ahow-to guide.
It explains concepts or processes used by the Wikipedia community. It is not one ofWikipedia's policies or guidelines, and may reflect varying levels ofconsensus.

This page will help you to fix thecite error message:

Cite error: The named reference "$1" was defined multiple times with different content (see thehelp page).

  • If you have read this help page and find something missing or confusing, please discuss it at themain talk page.
  • Please reference this page and the page where you have the problem so we can understand your issues.
  • For basic information on the footnotes system, seeReferencing for beginners; for advanced help, seeFootnotes.

Overview

[edit]
Further information:WP:REFNAME

If you are going to reference the same source multiple times, Wikipedia allows you to name those sources so you can just refer to a source named "foo" rather than having to recreate all of the details about the citation (the author, the title, etc.) over and over. The name is created like this:

<ref name="foo">content</ref>

Then, to invoke that footnote you have namedfoo, just type this:

<ref name="foo" />

Thecontent (the details of the citation) of the reference that has been named "foo" is thus defined only once but can be reused over and over.

Issues and resolution

[edit]

The error happens when a named reference is defined multiple times with different content. For example, first<ref name="foo">content1</ref> and later<ref name="foo">content2</ref>, where"foo" is repeated butcontent1 andcontent2 are different. The purpose of named references is to be able to invoke them elsewhere with<ref name="foo" />, but there must be a unique definition of the ref name "foo".

If the references withcontent1 andcontent2 are meant to be different then change one of the ref names, for examplename="bar" instead ofname="foo". If the reference is not meant to be invoked elsewhere then it can also be made unnamed by removingname="foo", but this is not necessary.

If the references are meant to be the same then replace one of the definitions by<ref name="foo" /> to invoke the other definition. It may technically work to make two identical definitions but this shouldnot be done. It causes confusion and will recreate the error if somebody later changes one of the definitions without making the same change to the other.

The error can also happen with empty ref names like<ref name="">content</ref> or<ref name>content</ref>. Ref names should not be empty. Either add a name or removename="".

Ref names may be generated by a template and produce names not in the wikitext. For example,{{sfn|Stokes|1979|p=2}} and{{sfn|Stokes|1979|pp=2}} may both produce references of form<ref name="FOOTNOTEStokes19792">...</ref>, causing the error message to use the ref name "FOOTNOTEStokes19792".p= is intended for a single page andpp= for a range.ps= must have the same value in each use of{{sfn}} where the other parameters are identical. An assigned value inps= cannot be combined with an omittedps= elsewhere on the page. If there is a blankps= then remove it.

See alsoTechnical Templates below.

Whole references may be transcluded from other pages. When the "Edit" or "Edit source" tab at top of a page is clicked, the bottom of the window will say "Pages transcluded onto the current version of this page". Click the text if no list is shown. Articles are more likely than other pages to contain named references.

The ref name in the error message may have replaced spaces by underscores and converted some special characters.

Names

[edit]

Names for footnotes and groups must follow these rules:

  • Names are case-sensitive. Please do not use raNdOM capitalization.
  • Namesmust not be purely numeric; the software will accept something like":31337" (which is punctuation plus a number), but it will ignore"31337" (purely numeric).
  • Names should have semantic value, so that they can be more easily distinguished from each other by human editors who are looking at the wikitext. This means that ref names like"Nguyen 2010" are preferred to names like":31337".
  • Names must be unique. You may not use the same name to define different groups or footnotes. Try to avoid picking a name that someone else is likely to choose for a new citation, such as":0" or"NYT".
  • Please consider keeping reference names short, simple, and restricted to the standardEnglish alphabet and numerals. If spaces are used, the following technical restrictions become relevant:
    • Quotation marks are preferred but optional if the only characters used are lettersA–Z,a–z, digits0–9, and the symbols!$%&()*,-.:;<@[]^_`{|}~. That is, all printable ASCII characters except#"'/=>?\ and space.
    • Inclusion of any other characters,including spaces, requires that the reference name be enclosed in quotes; for example,name="John Smith". But quote-enclosed reference names may not include a less-than sign (<) or a double straight quote symbol ("), which may, however, be included byescaping as&lt; and&quot; respectively.
    • The quote marks must be the standard, straight, double quotation marks ("); curly or other quotes will be parsed as part of the reference name.
  • You may optionally provide reference names even when the reference name is not required. This makes later re-use of the sourced reference easier.

Sfn

[edit]

If two or more calls to{{sfn}} use the same citation parameters, that is, if the author(s), year, and page number(s) are all identical, but there is some other difference, such as a use ofpp= vsp=, or a use ofps= in one but not the other, this issue will arise.

The solution is to make the calls identical. If theps= parameter was being used to include a quote or other extended content, use{{harvnb}} inside a<ref>...</ref> construct with the quote after the template but inside the ref tag structure.

Nested footnotes

[edit]

If there arenested footnotes, i.e. a reference within another reference, then the error can occur even if two definitions have identical text. Example where{{sfn}} will create a ref name with another reference inside it:

<ref name="Buna">Advance to Buna</ref>{{sfn|Blakeley|1956|ps=. Cited in Advance to Buna.<ref name=Buna />}}{{sfn|Blakeley|1956|ps=. Cited in Advance to Buna.<ref name=Buna />}}

Removing the inner reference will fix the error.

Examples

[edit]
The content of this message is dependent on the language setting inSpecial:Preferences. You can test how the error messages look in the most popular languages with these links:

Here the reference namedipsum was defined twice, but the second definition's content differs from the first (only the first definition is taken):

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<ref name="ipsum">Reference 1</ref> Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<ref name="ipsum">Reference 2</ref> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.<ref name="ipsum"/> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.==References=={{reflist}}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.[1] Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.[1] Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.[1] Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

References
  1. ^abcReference 1Cite error: The named reference "ipsum" was defined multiple times with different content (see thehelp page).

Technical

[edit]

Pages with this error message are placed intoPages with duplicate reference names. The system message page is atCite error references duplicate key.

Templates

[edit]
Tracked inPhabricator
Task T39256

In order to include variable data within a reference tag such as<ref ref_content name=ref_name>, the#tag parser function must be used. Currently#tag only supports balanced tags, not a singular tag, thus<tag_type element /> cannot normally be used in a template unless the element is hard coded.

However, Cite has been modified since 2008[1] to treat<ref name="ref-foo"></ref> identically to<ref name="ref-foo" />. Note that there cannot be even a space between the<ref . . .> and the</ref>, otherwise this will result in definition of the reference named "ref-foo" to be " ", which if meant to be second reference by name to an existing reference will cause a duplicate definition error. Correct code to produce a singular tag will look like{{#tag:ref ||name={{{parameter}}}}}, that is, no space between the two "|"s.

Policies and guidelines
General advice
Citing sources
Inline citations
Help for beginners
Advanced help
Footnote templates
Find references
Citation tools
(External links)
  1. ^Wikipedia:Village_pump_(technical)#.23tag_only_for_paired_tags_bug_workaround.3F
Retrieved from "https://en.wikipedia.org/w/index.php?title=Help:Cite_errors/Cite_error_references_duplicate_key&oldid=1257509541"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp