Template:YouTube: Difference between revisions

From VRChat Wiki
Patroll (talk | contribs)
m Fix broken tag closing
Hackebein (talk | contribs)
remove height parameter, add ratio parameter
Line 1: Line 1:
<div
<div
   class="youtube"
   class="youtube"
   style="max-width: 100%; aspect-ratio: 16 / 9; background-color: black; width: {{{2|560px}}}; height: {{{3|auto}}}; {{{4|}}}"
   style="max-width: 100%; aspect-ratio: {{{3|16 / 9}}}; background-color: black; width: {{{2|560px}}}; height: auto; {{{4|}}}"
   data-video-id="{{{1|PWLPw4RE9Ig}}}"
   data-video-id="{{{1|PWLPw4RE9Ig}}}"
  ></div>
  ></div>
Line 8: Line 8:
Embeds a YouTube video.
Embeds a YouTube video.


<nowiki>{{Youtube|id|width|height|styles}}</nowiki>
<nowiki>{{Youtube|id|width|ratio|styles}}</nowiki>
=== Example Usage ===
=== Example Usage ===
{{YouTube|PWLPw4RE9Ig}} <nowiki>{{YouTube|PWLPw4RE9Ig}}</nowiki>
{{YouTube|PWLPw4RE9Ig}} <nowiki>{{YouTube|PWLPw4RE9Ig}}</nowiki>
Line 14: Line 14:
{{YouTube|PWLPw4RE9Ig|200px}} <nowiki>{{YouTube|PWLPw4RE9Ig|200px}}</nowiki>
{{YouTube|PWLPw4RE9Ig|200px}} <nowiki>{{YouTube|PWLPw4RE9Ig|200px}}</nowiki>
<hr>
<hr>
{{YouTube|PWLPw4RE9Ig|300px|300px}} <nowiki>{{YouTube|PWLPw4RE9Ig|300px|300px}}</nowiki>
{{YouTube|PWLPw4RE9Ig|100%}} <nowiki>{{YouTube|PWLPw4RE9Ig|100%}}</nowiki>
<hr>
<hr>
{{YouTube|PWLPw4RE9Ig|100%}} <nowiki>{{YouTube|PWLPw4RE9Ig|100%}}</nowiki>
{{YouTube|qivRiGWcowI|300px|9 / 16}} <nowiki>{{YouTube|qivRiGWcowI|360px|9 / 16}}</nowiki>
<hr>
{{YouTube|qivRiGWcowI|30%|9 / 16}} <nowiki>{{YouTube|qivRiGWcowI|20%|9 / 16}}</nowiki>


=== Template parameters ===
=== Template parameters ===
Line 28: Line 30:
| width  || <code>2</code>|| Width in CSS units (e.g. 200px, 100%)
| width  || <code>2</code>|| Width in CSS units (e.g. 200px, 100%)
|-
|-
| height || <code>3</code>|| Height in CSS units (e.g. 200px, 100%)
| ratio || <code>3</code>|| Ratio (e.g. 16 / 9, 9 / 16, 1 / 1)
|-
|-
| style || <code>4</code>|| Custom CSS styles
| style || <code>4</code>|| Custom CSS styles

Revision as of 17:42, 9 April 2025

Documentation

Embeds a YouTube video.

{{Youtube|id|width|ratio|styles}}

Example Usage

{{YouTube|PWLPw4RE9Ig}}

{{YouTube|PWLPw4RE9Ig|200px}}

{{YouTube|PWLPw4RE9Ig|100%}}

{{YouTube|qivRiGWcowI|360px|9 / 16}}

{{YouTube|qivRiGWcowI|20%|9 / 16}}

Template parameters

Name Variable Description
id 1 ID of the video
width 2 Width in CSS units (e.g. 200px, 100%)
ratio 3 Ratio (e.g. 16 / 9, 9 / 16, 1 / 1)
style 4 Custom CSS styles