[ Disclaimer, Create new user --- Wiki markup help, Install P99 ]
Difference between revisions of "Template:Youtube"
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
− | This template allows you to embed a Youtube video in a page. To use it you simply | + | This template allows you to embed a Youtube video in a page. To use it you simply providing either an (embed) Youtube URL or an Youtube video ID, and optionally a height and width. |
Although you can use this template anywhere (appropriate) in the wiki, the [[Videos]] page is one great place to start. | Although you can use this template anywhere (appropriate) in the wiki, the [[Videos]] page is one great place to start. | ||
Line 20: | Line 20: | ||
{{youtube| https://www.youtube.com/embed/CBttHicGbek}} | {{youtube| https://www.youtube.com/embed/CBttHicGbek}} | ||
− | === Example #2: Specific Dimensions === | + | === Example #2: Basic With ID Instead of URL === |
+ | |||
+ | <code><nowiki>{{youtube | https://www.youtube.com/embed/CBttHicGbek}}</nowiki></code> | ||
+ | {{youtube| CBttHicGbek}} | ||
+ | |||
+ | === Example #3: Specific Dimensions === | ||
<code><nowiki>{{youtube | <code><nowiki>{{youtube | ||
Line 32: | Line 37: | ||
| width=400 | | width=400 | ||
}} | }} | ||
− | </noinclude><includeonly><div class="youtube-placeholder" {{#if: {{{height}}}| data-height="{{{height}}}"}} {{#if: {{{width}}}| data-width="{{{width}}}"}} data-url="{{{url|{{{1}}}}}}">Loading Video ...</div></includeonly> | + | </noinclude><includeonly><div class="youtube-placeholder" {{#if: {{{height}}}| data-height="{{{height}}}"}} {{#if: {{{width}}}| data-width="{{{width}}}"}} data-url="{{{url|{{{1|https://www.youtube.com/embed/{{{id}}}}}}}}}">Loading Video ...</div></includeonly> |
Revision as of 16:53, 25 October 2019
This template allows you to embed a Youtube video in a page. To use it you simply providing either an (embed) Youtube URL or an Youtube video ID, and optionally a height and width.
Although you can use this template anywhere (appropriate) in the wiki, the Videos page is one great place to start.
Contents |
IMPORTANT NOTE: URLs Must Be "Embed" URLs
The URL used must be an "embed" URL (ie. it should start with the Youtube URL, followed by "/embed/", then the video ID). You can get this URL by right-clicking on a Youtube video and choosing "Copy Embed Code". This will copy code like:
<iframe width="300" height="150" src="https://www.youtube.com/embed/CBttHicGbek" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
You want the URL inside the src="" part. In other words, you want:
<iframe width="300" height="150" src="
https://www.youtube.com/embed/CBttHicGbek" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Examples
Example #1: Basic
{{youtube | https://www.youtube.com/embed/CBttHicGbek}}
Example #2: Basic With ID Instead of URL
{{youtube | https://www.youtube.com/embed/CBttHicGbek}}
Example #3: Specific Dimensions
{{youtube
| url= https://www.youtube.com/embed/CBttHicGbek
| height=400
| width=400
}}