FANDOM


This Template is a shortcut for adding references.

Ui act question

Not to be confused with {{ref?}}, the request template

Read the usage info below, or read Forum:How to add a reference.

Avoiding problems

  • For compatibility, when references are used at the end of other templates resulting in four closing braces: }}}}, a space should be added between each pair: }} }}.
  • Due to references in quotes being transcluded into other places, such as Portal:Quotes and Template:Random/Quote, all references in any template should always contain the full reference, and not just the name. There are no issues with naming and using a full reference, so long as the full reference also matches.
Why full references must be used inside quotes and other templates

This is what happens when full references are not used in a quote template.


Usage: Unnamed

When only a single parameter is used, it is used as both the name and the reference.

  • Usage: {{ref| '''(label)''': [http://(link) (description)]}}

All references must include both a label and a description. Please explore the wiki and look at existing references if you do not understand how they are used.

  • Example: {{ref| '''Video''': [http://LameGamer.com/not_really_a_link LameGamer preview video 2]}}
  • Equivalent: <ref> '''Video''': [http://LameGamer.com/not_really_a_link LameGamer preview video 2]</ref>
  • Result: [1] (Hover, or scroll down)
Identical unnamed references are merged as if using a named reference. Neither style is preferred over the other.

Usage: Named

Parameter 1 is the name of the reference, which allows using a reference multiple times in an article. This is the reference identifier and must be unique to each reference, or the first reference will be used instead.

  • Note: The reference name "youtube gameplay" is insufficiently descriptive. Generic names such as this cause references to be merged on Portal:Quotes and other pages which list template information.

The first time a reference is used, the full reference must be given:

  • Usage: {{ ref | (name) | '''(label)''': [(link) (description)]}}

All references must include both a label and a description. Please explore the wiki and look at existing references if you do not understand how they are used.

  • Example: {{ ref | UniqueRefName | '''Video''': [http://LameGamer.com/not_really_a_link LameGamer preview video]}}
  • Equivalent: <ref name="UniqueRefName"> '''Video''': [http://LameGamer.com/not_really_a_link LameGamer preview video]</ref>
  • Result: [2] (Hover, or scroll down)

To use the same reference again, simply use the same name:

  • Usage: {{ ref | (name) }}
  • Example: {{ref | UniqueRefName }}
  • Result: <ref name="UniqueRefName" />
Named references are compatible with old style references, if the name is alphanumeric.
Non-alphanumeric symbols in reference names are stripped.
  • For example, '''Mission''': "[[Jailbreak]]" is exactly the same as using MissionJailbreak.

Name only

With a normal <ref>, a named call-back can be used before the full reference is specified, but the shortcut used to merge identical references makes this not posible with this template... unless you use the ""name"" parameter.

To use a named call-back before the full reference is specified:

  • Usage: {{ ref | name=(name) }}
  • Example: {{ref | name=UniqueRefName }}
  • Result: <ref name="UniqueRefName" />
More details
Using a named callback without "name="
  • Example: {{ref|LameGamerVideo3}}
  • Equivalent: <ref name="LameGamerVideo3"> LameGamerVideo3 </ref> - note what happens
  • Result: [3] (Hover, or scroll down)

But when the full reference is specified later:

  • Example: {{ref|LameGamerVideo3| '''Video''': [http://LameGamer.com/not_really_a_link LameGamer video 3]}}
  • Equivalent: <ref name="LameGamerVideo3"> '''Video''': [http://LameGamer.com/not_really_a_link LameGamer video 3]</ref>
  • Result: [3] (Hover, or scroll down)

The reference text is ignored, because the original LameGamerVideo3 reference uses "LameGamerVideo3" as the name and the reference text


Using a named callback with "name="

  • Example: {{ref|name=LameGamerVideo4}}
  • Equivalent: <ref name="LameGamerVideo4"></ref> - note the difference
  • Result: [4] (Hover, or scroll down)

And when the full reference is specified later:

  • Example: {{ref|LameGamerVideo4| '''Video''': [http://LameGamer.com/not_really_a_link LameGamer video 4]}}
  • Equivalent: <ref name="LameGamerVideo4"> '''Video''': [http://LameGamer.com/not_really_a_link LameGamer video 4]</ref>
  • Result: [4] (Hover, or scroll down)

The reference text works, because the original LameGamerVideo4 reference uses "LameGamerVideo4" as the name only. Specifying "name=" tells the template not to use it as the reference text


Invalid usage:

  • Example: {{ref|name=LameGamerVideo5| '''Video''': [http://LameGamer.com/not_really_a_link LameGamer video 5]}}

Using the name parameter tells the template to ignore the reference text.

Links containing = sign

References containing a "=" symbol trigger a "blank parameter" error.

Template parameters cannot normally contain the "=" symbol, because the "=" symbol indicates a named parameter. This most commonly affects YouTube links, but is triggered by any url containing a "=".

There are several ways to get around this, but the easiest method is to simply put "2=" before the reference.

  1. {{Ref|2=reference}} - {{ref|2=https://www.google.com/search?q=saints+row}}
For unnamed references, as 1= can be used, but be aware that a 1= in the second parameter will override the unnamed first parameter.

Full usage:

  • Example 5: {{ref|2= '''Google''': [https://www.google.com/search?q=saints+row Search results]}}
  • Result: [5] (Hover, or scroll down)

YouTube parameter

Rather than using "2=", there is a "youtube=" parameter.

  • Usage: {{ref|youtube= YoutubeID | description }}

At least one unnamed parameter is required, as a description of the video.

  • Example: {{ref|youtube=jFUM614FGkU|LameGamer youtube video}}
  • Result: [6] (Hover, or scroll down)
Time Index

When linking to a time index, use |youtube=jFUM614FGkU3&t=64s instead of |youtube=jFUM614FGkU3#t=64s. The parameter version is faster than the anchor version.

Naming a reference works slightly different, and unnamed parameters varying depending on how many are used.

No unnamed parameters
youtubeID used as name, error message used as link text
  • Example: {{ref|youtube=jFUM614FGkU1 }}
  • Result: Broken {{ref}} (no caption)
    • Invalid usage
One unnamed parameter
youtubeID used as name, parameter used as link text
  • Example: {{ref|youtube=(youtube id)|(description)}}
  • Example: {{ref|youtube=jFUM614FGkU2|This is a great video}}
  • Result: [7] (Hover, or scroll down)
    • "jFUM614FGkU2" is used as ref name, "this is a great video" is link text
Two unnamed parameters
first is name, second is link text
  • Example: {{ref|(name)|youtube=(youtube id)|(description)}}
  • Example: {{ref|GameplayFootage|youtube=jFUM614FGkU3|This is a great video}}
  • Result: [8] (Hover, or scroll down)
    • "GameplayFootage" is used as ref name, "this is a great video" is link text
Three unnamed parameters
first is name, second is link text, third is additional text
  • Example: {{ref|(name)|youtube=(youtube id)|(description)|(non-linked text)}}
  • Example: {{ref|GameplayFootage2|youtube=jFUM614FGkU3|This is a great video|This text comes after the link}}
  • Result: [9] (Hover, or scroll down)

Image parameter

The "image" parameter can now be used to add thumb images easily.

  • Usage: {{ref|image=(pagename without File: prefix) | Caption }}

At least one unnamed parameter is required, as a caption for the image.

  • Example: {{ref|image=Saints Row IV newsticker - Angel de LaMuerte in Piledriver the Musical.jpg|Newsticker mentioning Angel}}
  • Equivalent: {{ref|'''Image''': File:Saints Row IV newsticker - Angel de LaMuerte in Piledriver the Musical.jpg|600px|thumb|Newsticker mentioning Angel}}
  • Result: [10] (Hover, or scroll down)

Named references work the same: {{ref|newsticker|image=Saints Row IV newsticker - Angel de LaMuerte in Piledriver the Musical.jpg}} - but a single unnamed parameter will be used as both the name and the caption. Use a second unnamed parameter to specify a separate caption.

  • Example: {{ref|(name)|image=(filename)|(description)}}
  • Example: {{ref|newsticker2|image=Saints Row IV newsticker - Angel de LaMuerte in Piledriver the Musical.jpg|Newsticker mentioning Angel}}
  • Equivalent: {{ref|newsticker2|'''Image''': [[File:Saints Row IV newsticker - Angel de LaMuerte in Piledriver the Musical.jpg|600px|thumb|Newsticker mentioning Angel]]}}
  • Result: [11] (Hover, or scroll down)

Audio parameter

The "audio" parameter can now be used to add audio references easily.

  • Usage: {{ref|audio=(pagename without File: prefix) | Caption }}

At least one unnamed parameter is required, as a caption for the audio.

  • Example: {{ref|audio=SR2_VOC_WM_00779_Civilian_Sombrero.ogg|What's with Shaundi and that fucking sombrero?}}
  • Equivalent: {{ref|'''Audio''': {{audio|SR2_VOC_WM_00779_Civilian_Sombrero.ogg|What's with Shaundi and that fucking sombrero?}} }}
  • Result: [12] (Hover, or scroll down)

Named references work the same: {{ref|audio1|audio=SR2_VOC_WM_00779_Civilian_Sombrero.ogg}} - but a single unnamed parameter will be used as both the name and the caption. Use a second unnamed parameter to specify a separate caption.

  • Example: {{ref|(name)|audio=(filename)|(description)}}
  • Example: {{ref|audio2|audio=SR2_VOC_WM_00779_Civilian_Sombrero.ogg|What's with Shaundi and that fucking sombrero? (audio caption without name}}
  • Equivalent: {{ref|audio2|'''Audio''': {{audio|SR2_VOC_WM_00779_Civilian_Sombrero.ogg|What's with Shaundi and that fucking sombrero?}} }}
  • Result: [13] (Hover, or scroll down)

Tests

name test result
control <ref>control test</ref> [14]
tag {{#tag:ref|tag ref test}} [15]
Fail: youtube without 2= {{ref|'''Youtube''': [http://www.youtube.com/watch?v=anything}} Broken {{ref}} (youtube link)
Fail: youtube http {{ref|youtube=http://anything}} Broken {{ref}} (youtube link)
Fail: youtube link {{ref|youtube=[anything}} Broken {{ref}} (youtube link)
Fail: image File: {{ref|image=File:Angel.jpg}} Broken {{ref}} (image)
Fail: image http {{ref|image=http://anything}} Broken {{ref}} (image)
Fail: image link {{ref|image=[anything}} Broken {{ref}} (image)
Fail: too many "[[" breaks templates completely {{ref|missing [[end] bracket}} missing [[end] bracket}}
Fail: uneven link {{ref| missing [open]] bracket }} Broken {{ref}} (link uneven)
Fail: uneven link {{ref| link [not closed}} Broken {{ref}} (link uneven)
Fail: uneven link {{ref| link not] opened }} Broken {{ref}} (link uneven)
Fail: uneven template {{ref| template {not closed }} Broken {{ref}} (uneven template)
Fail: uneven template {{ref| template not} closed }} Broken {{ref}} (uneven template)
Fail: no params {{ref}} Broken {{ref}} (blank parameter)
Fail: 1 empty {{ref|}} Broken {{ref}} (blank parameter)
Fail: both empty {{ref||}} Broken {{ref}} (blank parameter)
Fail: 1 set, 2 empty {{ref|one1|}} Broken {{ref}} (blank parameter)
Fail: 1 empty, 2 set {{ref||two2}} Broken {{ref}} (blank parameter)
Fail: 1, 2 set, 3 empty {{ref|one3|two3|}} Broken {{ref}} (blank parameter)
Fail: 2= empty. {{ref|2=}} Broken {{ref}} (blank parameter)
Fail: 1= empty. {{ref|1=}} Broken {{ref}} (blank parameter)
Even link {{ref|[]}} [16]
Even template {{ref|{} }} [17]
1 set, 2 not set {{ref|one4}} [18]
1, 2 set (callback) {{ref|one4|two4}} [18]
1, 2 set (new) {{ref|one5|two5}} [19]
2= set {{ref|2=two6}} [20]
Name only (linked to test1) {{ref|name=named1}} [21]
test1 {{ref|named1|test1 name and reference1}} [21]
test2 {{ref|named1}} [21]
test3 {{ref|named2|test3 name and reference2}} [22]
test4 {{ref|test4 noref}} [23]
test1b {{ref|named1|test1 name and reference1}} [21]
test2b {{ref|named1}} [21]
test3b {{ref|named2|test3 name and reference2b}} [22]
test4 {{ref|test4 noref}} [23]

Example results

  1. Video: LameGamer preview video 2 (Usage: Unnamed)
  2. Video: LameGamer preview video (Usage: Named)
  3. 3.0 3.1 LameGamerVideo3
  4. 4.0 4.1 Video: LameGamer video 4 (Usage: Working name)
  5. YouTube: LameGamer youtube video (YouTube parameter example)
  6. YouTube: This is a great video (youtube, caption without name)
  7. YouTube: This is a great video (youtube, caption with name)
  8. YouTube: This is a great video This text comes after the link (youtube, caption with name)
  9. Image:
    Saints Row IV newsticker - Angel de LaMuerte in Piledriver the Musical

    Newsticker mentioning Angel (image, caption without name)

  10. Image:
    Saints Row IV newsticker - Angel de LaMuerte in Piledriver the Musical

    Newsticker mentioning Angel (image, caption with name)

  11. Audio:
    SR2 VOC WM 00779 Civilian Sombrero
    What's with Shaundi and that fucking sombrero? (audio without name)
  12. Audio:
    SR2 VOC WM 00779 Civilian Sombrero
    What's with Shaundi and that fucking sombrero? (audio with name)
  13. control test
  14. tag ref test
  15. []
  16. {}
  17. 18.0 18.1 one4
  18. two5
  19. two6
  20. 21.0 21.1 21.2 21.3 21.4 test1 name and reference1
  21. 22.0 22.1 test3 name and reference2
  22. 23.0 23.1 test4 noref
Community content is available under CC-BY-SA unless otherwise noted.