Template:YouTube: Difference between revisions
Zackmann08 (talk | contribs) Adding unknown parameter tracking through Category:Pages using youTube with unknown parameters using Module:check for unknown parameters |
sync with sandbox - adds identifiers to the wikilinks |
||
(16 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
[https://www.youtube.com/{{#if:{{{ |
[https://www.youtube.com/{{#if:{{{channel|{{{c|}}}}}} |
||
| |
|channel/{{{channel|{{{c|}}}}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki />{{{title|{{{1}}}}}}}}</span>|{{PAGENAMEBASE}}}}{{{suffix|'s}}} channel] on {{#ifeq:{{{link}}}|no|YouTube|[[YouTube channel (identifier)|YouTube]]}} |
||
|{{#if:{{{ |
|{{#if:{{{handle|{{{h|}}}}}} |
||
| |
|@{{{handle|{{{h|}}}}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki />{{{title|{{{1}}}}}}}}</span>|{{PAGENAMEBASE}}}}{{{suffix|'s}}} channel] on {{#ifeq:{{{link}}}|no|YouTube|[[YouTube handle (identifier)|YouTube]]}} |
||
|{{#if:{{{ |
|{{#if:{{{user|{{{u|}}}}}} |
||
| |
|user/{{{user|{{{u|}}}}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki />{{{title|{{{1}}}}}}}}</span>|{{PAGENAMEBASE}}}}{{{suffix|'s}}} channel] on {{#ifeq:{{{link}}}|no|YouTube|[[YouTube user (identifier)|YouTube]]}} |
||
|{{#if:{{{ |
|{{#if:{{{custom|}}} |
||
| |
|c/{{{custom}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki />{{{title|{{{1}}}}}}}}</span>|{{PAGENAMEBASE}}}}{{{suffix|'s}}} channel] on {{#ifeq:{{{link}}}|no|YouTube|[[YouTube custom (identifier)|YouTube]]}} |
||
|{{#if:{{{show|{{{s|}}}}}} |
|||
|show/{{{show|{{{s|}}}}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki />{{{title|{{{1}}}}}}}}</span>|''{{PAGENAMEBASE}}''}}] show on {{#ifeq:{{{link}}}|no|YouTube|[[YouTube show (identifier)|YouTube]]}} |
|||
⚫ | |||
| {{error|Error:No page id specified}}]{{Namespace detect |
|||
|playlist?list={{{playlist|{{{p|}}}}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki />{{{title|{{{1}}}}}}}}</span>|{{PAGENAMEBASE}}}}] playlist on {{#ifeq:{{{link}}}|no|YouTube|[[YouTube playlist (identifier)|YouTube]]}} |
|||
⚫ | |||
|{{#if:{{{id|{{{1<includeonly>|</includeonly>}}}}}} |
|||
⚫ | |||
|watch?v={{{id|{{Trim|{{{1|}}}}}}}}{{#if:{{{time|{{{t|}}}}}}|&t={{{time|{{{t|}}}}}}}} {{#if:{{{title|}}}|<span class="plainlinks">{{replace|{{delink|<nowiki />{{{title}}}}}|]|]}}</span>|{{#if:{{{id|}}}|{{#if:{{{1|}}}|<span class="plainlinks">{{replace|{{delink|<nowiki />{{{1}}}}}|]|]}}</span>|Video}}|{{#if:{{{2|}}}|<span class="plainlinks">{{replace|{{delink|<nowiki />{{{2}}}}}|]|]}}</span>|Video}}}}}}] on {{#ifeq:{{{link}}}|no|YouTube|[[YouTube video (identifier)|YouTube]]}} |
|||
|{{error|Error:No page id specified}}] on {{#ifeq:{{{link}}}|no|YouTube|[[YouTube]]}}{{Namespace detect |talk=|wikipedia=|help=|template=|module= |other=[[Category:Articles using YouTube with invalid parameters]] }} |
|||
}} |
|||
}} |
}} |
||
}} |
}} |
||
Line 17: | Line 20: | ||
}} |
}} |
||
}} |
}} |
||
}} on {{#ifeq:{{{link}}}|no |
|||
|YouTube |
|||
|[[YouTube]] |
|||
}}{{#ifexpr:{{#expr: |
}}{{#ifexpr:{{#expr: |
||
{{#if:{{{ |
{{#if:{{{channel|{{{c|}}}}}}|1|0}}+ |
||
{{#if:{{{ |
{{#if:{{{handle|{{{h|}}}}}}|1|0}}+ |
||
{{#if:{{{ |
{{#if:{{{user|{{{u|}}}}}}|1|0}}+ |
||
{{#if:{{{ |
{{#if:{{{custom|}}}|1|0}}+ |
||
{{#if:{{{show|}}}|1|0}}+ |
{{#if:{{{show|{{{s|}}}}}}|1|0}}+ |
||
{{#if:{{{ |
{{#if:{{{playlist|{{{p|}}}}}}|1|0}}+ |
||
⚫ | |||
{{#if:{{{p|}}}|1|0}}+ |
|||
{{#if:{{{id|}}}|1|0}}+ |
{{#if:{{{id|}}}|1|0}}+ |
||
{{#if:{{{2|}}}|1|0}}+ |
{{#if:{{{2|}}}|1|0}}+ |
||
Line 37: | Line 35: | ||
|other=[[Category:Articles using YouTube with invalid parameters]] |
|other=[[Category:Articles using YouTube with invalid parameters]] |
||
}} |
}} |
||
}}{{#if:{{{ |
}}{{#if:{{{channel|{{{c|}}}}}}{{{handle|{{{h|}}}}}}{{{user|{{{u|}}}}}}{{{custom|}}} |
||
||{{#ifeq:{{{suffix| |
||{{#ifeq:{{{suffix|+}}}|{{{suffix|-}}}|{{Namespace detect |
||
⚫ | |||
||{{Namespace detect |
|||
⚫ | |||
|talk=|wikipedia=|help=|template=|module= |
|||
|other=[[Category:Articles using YouTube with invalid parameters]] |
|||
}} |
}} |
||
}} |
}} |
||
}}<!-- |
|||
-->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using YouTube with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:YouTube]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | c | channel | custom | h | handle | id | link | p | playlist | s | show | suffix | t | time | title | u | user }}<noinclude>{{documentation}}</noinclude> |
Latest revision as of 16:24, 29 May 2023
Do not use this template to link to material that violates copyright law. Links to such material must either be replaced with a non-copyvio link or removed immediately. NOTE: A YouTube video uploaded by a user with a verification check mark badge, indicating that it is an official channel of an established creator or organization, does not fully guarantee that it complies with copyright and fair use laws. |
This template is used on approximately 67,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template should not be used in citation templates such as Citation Style 1 and Citation Style 2, because it includes markup that will pollute the COinS metadata they produce; see Wikipedia:COinS. |
This template is used to create an external link to YouTube in the ==External links== section. It may also be used for other YouTube links such as those in {{External media}}.
This is not a citation template. Use {{cite AV media}} to provide bibliographic citations in footnotes. Alternatively, use {{cite news}} if the video is a newscast, or {{cite episode}} if the video is in an episodic format.
Note that this template makes it clear that it "has" various Wikidata property elements, it does not automatically "use" the information stored in Wikidata – the VIDEOID, CHANNELID, HANDLE, USERNAME, SHOWID or PLAYLISTID alphanumeric parameters mentioned below must be entered by hand in the template.
Usage and examples
Video
- YouTube video ID (P1651) (see uses)
Usage (one parameter):
{{YouTube|VIDEOID}}
{{YouTube|id=VIDEOID}}
Usage (two parameters):
{{YouTube|VIDEOID|TITLE}}
{{YouTube|id=VIDEOID|title=TITLE}}
Parameter descriptions:
- id (or unnamed parameter 1) is the "YouTube video id" which appears as:
- https://www.youtube.com/watch?v=VIDEOID
- title (or unnamed parameter 2) gives an optional description that may replace the default title (Video)
Examples (1 parameter):
Examples (2 parameters):
* {{YouTube|9bZkp7q19f0|"Gangnam Style"}}
* {{YouTube|id=9bZkp7q19f0|title="Gangnam Style"}}
With timestamp
Usage:
{{YouTube|id=VIDEOID|time=TIMESTAMP}}
{{YouTube|id=VIDEOID|t=TIMESTAMP}}
Parameter descriptions:
- time or t is the timestamp within the video for the link target.
Examples:
{{YouTube|id=9bZkp7q19f0|time=3m2s}}
{{YouTube|id=9bZkp7q19f0|time=122}}
{{YouTube|id=9bZkp7q19f0|t=3m2s}}
Channel
With channel ID
Usage (one parameter):
{{YouTube|c=CHANNELID}}
{{YouTube|channel=CHANNELID}}
Usage (two parameters):
{{YouTube|c=CHANNELID|TITLE}}
{{YouTube|c=CHANNELID|title=TITLE}}
{{YouTube|channel=CHANNELID|TITLE}}
{{YouTube|channel=CHANNELID|title=TITLE}}
Parameter descriptions:
- c or channel is the "YouTube channel id" which appears as:
- https://www.youtube.com/channel/CHANNELID
- title gives an optional description that may replace the default title (PAGENAME)
Examples (1 parameter):
* {{YouTube|c=UC-9-kyTW8ZkZNDHQJ6FgpwQ}}
* {{YouTube|channel=UC-9-kyTW8ZkZNDHQJ6FgpwQ}}
Example (2 parameters):
* {{YouTube|c=UC-9-kyTW8ZkZNDHQJ6FgpwQ|#Music}}
* {{YouTube|channel=UC-9-kyTW8ZkZNDHQJ6FgpwQ|title=#Music}}
With handle
- YouTube handle (P11245) (see uses)
Usage (one parameter):
{{YouTube|h=HANDLE}}
{{YouTube|handle=HANDLE}}
Usage (two parameters):
{{YouTube|h=HANDLE|TITLE}}
{{YouTube|h=HANDLE|title=TITLE}}
{{YouTube|handle=HANDLE|TITLE}}
{{YouTube|handle=HANDLE|title=TITLE}}
Parameter descriptions:
- h or handle is the "YouTube channel handle" which appears as:
- https://www.youtube.com/@HANDLE
- title gives an optional description that may replace the default title (PAGENAME)
- suffix replaces the default " 's " after the channel name. It is only to be used in the rare occasion that the channel name is a compound noun ending in S, and making it possessive does not repeat the S sound. Do not use it for a brand name ending in S, for example Smosh Games, which is a singular entity. See MOS:POSS for more information.
Examples (1 parameter):
* {{YouTube|h=PewDiePie}}
* {{YouTube|handle=PewDiePie}}
Example (2 parameters):
* {{YouTube|h=PewDiePie|PewDiePie}}
* {{YouTube|handle=PewDiePie|title=PewDiePie}}
Example (3 parameters):
* {{YouTube|handle=officialBEG|title=Brown Eyed Girls|suffix='}}
With legacy username
Usage (one parameter):
{{YouTube|u=USERNAME}}
{{YouTube|user=USERNAME}}
Usage (two parameters):
{{YouTube|u=USERNAME|TITLE}}
{{YouTube|u=USERNAME|title=TITLE}}
{{YouTube|user=USERNAME|TITLE}}
{{YouTube|user=USERNAME|title=TITLE}}
Parameter descriptions:
- u or user is the "YouTube channel user's name" which appears as:
- https://www.youtube.com/user/USERNAME
- title gives an optional description that may replace the default title (PAGENAME)
- suffix replaces the default " 's " after the channel name. It is only to be used in the rare occasion that the channel name is a compound noun ending in S, and making it possessive does not repeat the S sound. Do not use it for a brand name ending in S, for example Smosh Games, which is a singular entity. See MOS:POSS for more information.
Examples (1 parameter):
* {{YouTube|u=pewdiepie}}
* {{YouTube|user=pewdiepie}}
Example (2 parameters):
* {{YouTube|u=pewdiepie|PewDiePie}}
* {{YouTube|user=pewdiepie|title=PewDiePie}}
Example (3 parameters):
* {{YouTube|user=officialBEG|title=Brown Eyed Girls|suffix='}}
With custom URL
Usage (one parameter):
{{YouTube|custom=CUSTOMURL}}
Usage (two parameters):
{{YouTube|custom=CUSTOMURL|TITLE}}
{{YouTube|custom=CUSTOMURL|title=TITLE}}
Parameter descriptions:
- custom is the "YouTube channel custom URL" which appears as:
- https://www.youtube.com/c/CUSTOMURL
- title gives an optional description that may replace the default title (PAGENAME)
Example (1 parameter):
* {{YouTube|custom=officialBEG}}
Example (2 parameters):
* {{YouTube|custom=officialBEG|Brown Eyed Girls}}
Show
Usage (one parameter):
{{YouTube|s=SHOWID}}
{{YouTube|show=SHOWID}}
Usage (two parameters):
{{YouTube|s=SHOWID|TITLE}}
{{YouTube|s=SHOWID|title=TITLE}}
{{YouTube|show=SHOWID|TITLE}}
{{YouTube|show=SHOWID|title=TITLE}}
Parameter descriptions:
- s or show is the "YouTube show name" which appears as:
- https://www.youtube.com/show/SHOWID
- title gives an optional description that may replace the default title (PAGENAME)
Examples (1 parameter):
* {{YouTube|s=SCWdVLvom3QaFGxEKNASntaA}}
* {{YouTube|show=SCWdVLvom3QaFGxEKNASntaA}}
Example (2 parameters):
* {{YouTube|s=SCWdVLvom3QaFGxEKNASntaA|Star Trek: The Original Series}}
* {{YouTube|show=SCWdVLvom3QaFGxEKNASntaA|title=Star Trek: The Original Series}}
Playlist
Usage (one parameter):
{{YouTube|p=PLAYLISTID}}
{{YouTube|playlist=PLAYLISTID}}
Usage (two parameters):
{{YouTube|p=PLAYLISTID|TITLE}}
{{YouTube|p=PLAYLISTID|title=TITLE}}
{{YouTube|playlist=PLAYLISTID|TITLE}}
{{YouTube|playlist=PLAYLISTID|title=TITLE}}
Parameter descriptions:
- p or playlist is the "YouTube playlist id" which appears as:
- https://www.youtube.com/playlist?list=PLAYLISTID
- title gives an optional description that may replace the default title (PAGENAME)
Examples (1 parameter):
* {{YouTube|p=PLrEnWoR732-DZV1Jc8bUpVTF_HTPbywpE}}
* {{YouTube|playlist=PLrEnWoR732-DZV1Jc8bUpVTF_HTPbywpE}}
Example (2 parameters):
* {{YouTube|p=PLrEnWoR732-DZV1Jc8bUpVTF_HTPbywpE|Learn Something New}}
- Learn Something New playlist on YouTube
* {{YouTube|playlist=PLrEnWoR732-DZV1Jc8bUpVTF_HTPbywpE|title=Learn Something New}}
- Learn Something New playlist on YouTube
Suppress wikilink
The link to YouTube can be suppressed with the parameter |link=no
. Example:
* {{YouTube|9bZkp7q19f0|"PSY - GANGNAM STYLE(강남스타일) M/V"|link=no}}
- "PSY - GANGNAM STYLE(강남스타일) M/V" on YouTube
No ID in template
The template will display an error message if no parameters are provided.
* {{YouTube}}
It will display an error message if the parameter provided is not known.
* {{YouTube|ID=test}}
TemplateData
TemplateData for YouTube
Use this to create an external link to YouTube in the External links section. This is not a citation template.
Parameter | Description | Type | Status | |
---|---|---|---|---|
YouTube video id | id 1 | The video id which appears after https://www.youtube.com/watch?v= in the URL
| String | suggested |
Timestamp | time t | The timestamp within the video for the link target; usually appears after &t= in the full URL or ?t= in a shortened URL
| String | optional |
YouTube channel id | channel c | The channel id which appears after https://www.youtube.com/channel/ in the URL
| String | suggested |
YouTube channel handle | handle h | The user name which appears after https://www.youtube.com/@ in the URL
| String | optional |
YouTube legacy username | user u | The user name which appears after https://www.youtube.com/user/ in the URL
| String | optional |
YouTube channel custom URL fragment slug | custom | The channel custom URL slug which appears after https://www.youtube.com/c/ in the URL
| String | optional |
YouTube show id | show s | The show id which appears after https://www.youtube.com/show/ in the URL
| String | suggested |
YouTube playlist id | playlist p | The playlist id which appears after https://www.youtube.com/playlist?list= in the URL
| String | suggested |
Title | title 2 | The name of the page being linked to
| String | suggested |
Channel title suffix | suffix | Text immediately after the channel title. It is only to be used in the rare occasion that the channel title is a compound noun ending in S, and making it possessive does not repeat the S sound.
| String | optional |
Link on | link | Set this parameter to no to suppress the link to the YouTube article
| String | optional |
Tracking categories
- Category:Articles using YouTube with invalid parameters (57) – list of pages using this template with too many parameters, or with invalid text in the
|title=
parameter. - Category:Pages using YouTube with unknown parameters (0) – list of pages using this template with unsupported parameters.
See also
- {{External media}} – to link to external media, including YouTube videos
- {{Cite AV media}} – to cite a video
- {{Cite news}} – to cite a newscast
- {{Cite episode}} – to cite an episode of a show
- {{Cite serial}} – to cite a serial of a show
- {{YouTube navbox}} – navigation box for YouTube related articles
- WP:YOUTUBE – YouTube linking guideline
- Wikipedia:WikiProject Internet culture – Wikiproject covering YouTube personalities and videos
- All Wikipedia pages linked to http://*.youtube.com and to https://*.youtube.com
- Search for Wikipedia articles using this template as a reference