Difference between revisions of "Template:comic/doc"
m |
Firestar233 (talk | contribs) (making documentation more concise) |
||
| Line 5: | Line 5: | ||
'''This template has an associated sandbox, available at [[Template:comic/sandbox]].''' </noinclude>This is the basic infobox-style header template used to display [[xkcd]] comics on their own pages, including the comic number (with external link to xkcd), publication date, title, comic image, and title text. | '''This template has an associated sandbox, available at [[Template:comic/sandbox]].''' </noinclude>This is the basic infobox-style header template used to display [[xkcd]] comics on their own pages, including the comic number (with external link to xkcd), publication date, title, comic image, and title text. | ||
__NOTOC__ | __NOTOC__ | ||
| − | == Example == | + | == Example 1 == |
{{comic/sandbox | {{comic/sandbox | ||
| Line 45: | Line 45: | ||
=== Notes === | === Notes === | ||
| − | * | + | * '''<code>number</code>''', '''<code>title</code>''', and '''<code>image</code>''' are the comic number, comic title, and comic image, and are required. |
| − | * | + | * '''<code>date</code>''' is the date the comic was published and should be written in the form <code>mmmm d, yyyy</code> (full month name, day number without padding, 4-digit year; i.e. <code>January 1, 2006</code> for 2006-1-1) |
| − | * | + | * '''<code>imagesize</code>''' limits the size of the image in units of pixels. This parameter is optional. |
| − | ** | + | ** To limit the width, simply list the width (e.g.: "350px"). |
| − | ** | + | ** To limit the height, prepend an "x" to the desired height (e.g.: "x350px" |
** Warning: If the '''<code>imagesize</code>''' is larger than the '''<code>image</code>''', the image will be stretched. | ** Warning: If the '''<code>imagesize</code>''' is larger than the '''<code>image</code>''', the image will be stretched. | ||
| − | * | + | * '''<code>noexpand</code>''' is a boolean parameter indicating whether the "Click comic to enlarge" button is hidden, usually used when '''<code>imagesize</code>''' is limiting the size of the comic. To hide the button, set this to <code>true</code>. This parameter is optional. |
| − | |||
| − | |||
| − | * '''<code>before</code>''' is | + | * '''<code>before</code>''' is used to insert text before the comic, usually to insert a link to skip to the explanation on extremely large comics like [[1732: Earth Temperature Timeline]]. The text provided to this parameter is placed on the line between the title and the image. This parameter is optional. |
| + | ** The wikitext to skip to the explanation is <code><nowiki>[[#Explanation|↓ Skip to explanation ↓]]</nowiki></code>. | ||
| − | * | + | * '''<code>custom</code>''' overrides the '''<code>image</code>''' parameter and replaces the image with the text provided. This parameter is optional. |
* If '''<code>number</code>''' is left undefined, most of the navigation bar will be disabled; at least '''<code>lappend</code>''' must be defined if '''<code>number</code>''' is undefined. | * If '''<code>number</code>''' is left undefined, most of the navigation bar will be disabled; at least '''<code>lappend</code>''' must be defined if '''<code>number</code>''' is undefined. | ||
Revision as of 20:11, 18 April 2025
This page WILL BE transcluded into Template:comic as its documentation. (once the changes are approved by an admin)
This template has an associated sandbox, available at Template:comic/sandbox. This is the basic infobox-style header template used to display xkcd comics on their own pages, including the comic number (with external link to xkcd), publication date, title, comic image, and title text.
Example 1
| Suspension Bridge |
Title text: As a first step, they can put in a secondary deck, to help drivers try it out and find out how fun the jumps are. After a while no one will use the old flat deck and they can remove it. |
Example 2
| Barrel - Part 1 |
| Original title: Barrel |
![]() Title text: Don't we all. Original caption: He's fairly upbeat about the situation! |
Usage
{{comic
| number =
| date =
| title =
| before =
| image =
| custom =
| imagesize =
| noexpand =
| titletext =
| ldomain =
| lappend =
}}
Notes
-
number,title, andimageare the comic number, comic title, and comic image, and are required.
-
dateis the date the comic was published and should be written in the formmmmm d, yyyy(full month name, day number without padding, 4-digit year; i.e.January 1, 2006for 2006-1-1)
-
imagesizelimits the size of the image in units of pixels. This parameter is optional.- To limit the width, simply list the width (e.g.: "350px").
- To limit the height, prepend an "x" to the desired height (e.g.: "x350px"
- Warning: If the
imagesizeis larger than theimage, the image will be stretched.
-
noexpandis a boolean parameter indicating whether the "Click comic to enlarge" button is hidden, usually used whenimagesizeis limiting the size of the comic. To hide the button, set this totrue. This parameter is optional.
-
beforeis used to insert text before the comic, usually to insert a link to skip to the explanation on extremely large comics like 1732: Earth Temperature Timeline. The text provided to this parameter is placed on the line between the title and the image. This parameter is optional.- The wikitext to skip to the explanation is
[[#Explanation|↓ Skip to explanation ↓]].
- The wikitext to skip to the explanation is
-
customoverrides theimageparameter and replaces the image with the text provided. This parameter is optional.
- If
numberis left undefined, most of the navigation bar will be disabled; at leastlappendmust be defined ifnumberis undefined.-
lappend(Link APPEND) is the text that is appended toxkcd.com/in the link. -
ldomain(Link DOMAIN) is the subdomain of the link, defaulting towww. It is placed before.xkcd.com/- For example, if the link is to a blog post (blog.xkcd.com),
ldomaincan be defined asblog.
- For example, if the link is to a blog post (blog.xkcd.com),
- The resulting link will be
ldomain.xkcd.com/lappendwhenevernumberis undefined.
-
The example above is produced by the following code:
{{comic
| number = 3048
| date = February 7, 2025
| title = Suspension Bridge
| image = suspension_bridge_2x.png
| imagesize = 362x365px
| noexpand = true
| titletext = As a first step, they can put in a secondary deck, to help drivers try it out and find out how fun the jumps are. After a while no one will use the old flat deck and they can remove it.
}}

