Difference between revisions of "Template:YouTube"

From Nookipedia, the Animal Crossing wiki
(A much-needed update for template. Have added height and width parameters so we can manually fix placement issues.)
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{|style="margin: 0.5em; margin-top:0 !important; padding: 3px 0 3px 0 !important; margin-{{#switch:{{{3|}}}|{{Void}}=left|left=left|right=right|center=center|#default=left}}:0 !important; background-color:#000000; border: 2px solid #0f0f0f;width:100px;float:{{#switch:{{{3|}}}|{{Void}}=left|left=left|right=right|center=center|#default=left}}"
+
<includeonly><!--
|<div>
+
-->{|style="background-color:#F8F9FA; <!--
|{{#ev:youtube|{{{1}}}|{{#ifeq:{{{2|}}}|{{Void}}|250|{{{2|}}}}}}}{{#switch:{{{3|}}}|{{Void}}={{#ifeq:{{{4|}}}|{{Void}}|{{Void}}|<br>{{{4|}}}}}|left={{#ifeq:{{{4|}}}|{{Void}}|{{Void}}|<br>{{{4|}}}}}|right={{#ifeq:{{{4|}}}|{{Void}}|{{Void}}|<br>{{{4|}}}}}|center={{#ifeq:{{{4|}}}|{{Void}}|{{Void}}|<br>{{{4|}}}}}|#default={{#ifeq:{{{3|}}}|{{Void}}|{{Void}}|<br>{{{3|}}}}}}}
+
        -->padding: 3px 4px; <!--       padding: top/bottom right/left;
|</div>
+
        -->border: 1px solid #C8CCD1; <!--
|}</includeonly><noinclude>{{t|Youtube|Video Code|Video Size|Location|Caption}}
+
        -->height: {{{height|200px}}}; <!--
 
+
        -->width: {{{width|250px}}}; <!--
Where:
+
        -->margin: 0 0.5em 0.5em; <!--          margin: top right/left bottom;
*'''''Video Code''''' is the unique sequence of letters, numbers, and characters that point to the video.
+
        -->margin-{{#switch:{{{3|}}}
*'''''Video Size''''' is the desired size of the video. Defaults to 250 pixels.
+
                  |right   = right
*'''''Location''''' is where to have the video. (i.e. right, left, or center.) Defaults to left if blank.
+
                  |center   = center
*'''''Caption''''' is an optional caption to describe the video.
+
                  |#default = left
**If ''location'' is neither '''left''', '''right''', nor '''center''', then the it is assumed to be a caption and the video's location is set to "left".
+
                  }}: 0; <!--
 
+
        -->float: {{#switch:{{{3|}}}
[[Category:Templates]]</noinclude>
+
                  |right   = right
 +
                  |center   = center
 +
                  |#default = left
 +
                  }}"
 +
|style="vertical-align: top;"|{{#ev:youtube
 +
|{{{1}}}                                 <!-- id -->
 +
|{{#if:{{{2|}}}|{{{2}}}|250}}           <!-- width -->
 +
}}{{#switch:{{{3|}}}
 +
  |{{Void}}|left|right|center = {{{4|}}} <!-- If {3} = Location, return the caption {4} -->
 +
  |#default                   = {{{3|}}} <!-- Else, return the caption {3} -->
 +
  }}
 +
|}</includeonly><noinclude>{{Documentation}}[[Category:Templates]]</noinclude>

Revision as of 10:22, March 20, 2020

Template documentation (view)


Usage

{{YouTube|<video id>|<video size>|<location>|<caption>|height=|width=|file=}}

This template is used to create a thumbnail in which YouTube videos can be embedded. All such videos should be placed under a Videos section heading. The parameters are as follows:

  • video id is the unique sequence of letters, numbers, and characters found at the end of the video's URL.
  • video size is the desired size of the video. Defaults to 250px.
  • location is where to position the float of the video (i.e. right, left, or center). Defaults to left if blank.
  • caption is text that will be displayed in the thumbnail below the video.
  • height is the height of the bounding box. Defaults to 250px.
    • For best practice, all videos that are grouped together should have the same height, otherwise they may be displayed strangely on the page. Height will only need to be set manually if the videos drastically differ in the length of their captions such that some take up multiple lines and others less.
  • width is the width of the bounding box. Defaults to 200px.
  • file overrides the YouTube video and should only be used in the event that a video that was previously available on YouTube is removed.

Example

{{YouTube|kEJXS0MiKOA|250|left|Teaser from Nintendo Direct on September 13, 2018}}
Teaser from Nintendo Direct on September 13, 2018

When grouping videos, the same height must be set for all of them to avoid visual placement issues. This will need to be done manually if the length of their captions greatly differ.

{{YouTube|kEJXS0MiKOA|250|left|Teaser from Nintendo Direct on September 13, 2018|height=230px}}
{{YouTube|_3YNL0OWio0|250|left|E3 Nintendo Direct Trailer 2019|height=230px}}
{{YouTube|dEh3MPy4GAU|250|left|E3 Nintendo Treehouse gameplay featuring [[Aya Kyogoku]] and [[Hisashi Nogami]]|height=230px}}
Teaser from Nintendo Direct on September 13, 2018
E3 Nintendo Direct Trailer 2019
E3 Nintendo Treehouse gameplay featuring Aya Kyogoku and Hisashi Nogami