Template:Ytc-id
Documentation
This template constructs a YouTube channel identifier in any of the forms that appear in YouTube URLs. It doesn't actually generate a full valid URL nor a working link; other templates that call this one do those things. (See especially {{ytc}}.)
The name of this template is based on the phrase "youtube channel identifier" or just "youtube channel id".
The four types of YouTube channel identifiers are prefixed in the channel's URL by:
channel/…c/…user/…@…
Of these types, the oldest and most "stable" is channel/…. The only way that identifier changes is if someone deletes their channel and creates a totally new one. user/… is also very old, but users can rename themselves, so it is a less stable form to use for links. c/… is newer and can also change, like user names. @… is the newest form, and can also change.
The channel/… type of identifier is generally not shown in the URL if the channel has any other way of being identified. You can find it in the HTML source of the page in:
- the
<meta>element with attributeitemprop="identifier" - the
<link>element with attributerel="canonical" - the JSON↗ block of data, in the value of
originalUrl
and lots of other places.
Usage
{{ytc-id|identifier}}{{ytc-id|channel=|c=|user=|@=}}
In the first form, the identifier value is used as-is. This can be used for any of the identifier formats.
The parameters channel, c, user, and @ correspond to the four formats seen above. They are checked in that order, and the first one with a true value is used (overriding any value used in the first positional parameter). The template provides the appropriate text in front of the value, as seen in the examples below.
The named parameter at is provided as an alias of @. Any value assigned to @ — including an empty one — will override or "hide" the value of at.
Examples
{{ytc-id|AngelinaJordanOfficial}}⇒ AngelinaJordanOfficial{{ytc-id|@AngelinaJordanOfficial}}⇒ @AngelinaJordanOfficial{{ytc-id|@=AngelinaJordanOfficial}}⇒ @AngelinaJordanOfficial{{ytc-id|channel/UC1Pwa4nFvIPbtYVLcBGDpjA}}⇒ channel/UC1Pwa4nFvIPbtYVLcBGDpjA{{ytc-id|channel=UC1Pwa4nFvIPbtYVLcBGDpjA}}⇒ channel/UC1Pwa4nFvIPbtYVLcBGDpjA{{ytc-id|c=AngelinaJordanOfficial}}⇒ c/AngelinaJordanOfficial{{ytc-id|channel=UC1Pwa4nFvIPbtYVLcBGDpjA|c=AngelinaJordanOfficial}}⇒ channel/UC1Pwa4nFvIPbtYVLcBGDpjA{{ytc-id|channel=|c=JonathanSugarfootMoffett|user=}}⇒ c/JonathanSugarfootMoffett{{ytc-id|channel=|c=|user=iv4nl1v3z}}⇒ user/iv4nl1v3z
The first form, where the name of the channel is used directly, with no leading @, c/, etc., is probably not guaranteed to work. It's better to use one of the more "explicit" forms in the other examples.
The last three examples illustrate how the value of channel overrides that of c (and c would override user, and so on, as explained above), but empty values of named parameters don't override the values of other named parameters (except that an empty @= will override at).
See also
{{ytc}}and the other YouTube-related templates listed there