Difference between revisions of "Template:comic/doc"
Firestar233 (talk | contribs) (grabbing some undocumented parameters from the template) |
(Usually, less is more added the two new parameters, oglink and ogtitle) |
||
| 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__ | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
== Usage == | == Usage == | ||
| − | |||
<pre>{{comic | <pre>{{comic | ||
| number = | | number = | ||
| date = | | date = | ||
| title = | | title = | ||
| + | | oglink = | ||
| + | | ogtitle = | ||
| before = | | before = | ||
| image = | | image = | ||
| Line 45: | Line 23: | ||
=== Notes === | === Notes === | ||
| − | * '''<code>number</code>''', '''<code>title</code>''', and '''<code>image</code>''' are the comic number, comic title, and comic image. | + | * '''<code>number</code>''', '''<code>title</code>''', and '''<code>image</code>''' are the comic number, comic title, and comic image. In normal circumstances, they should always be defined. |
| + | |||
| + | * '''<code>date</code>''' is the date the comic was first 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>). If the comic [[:Category:No date|has no date]] or [[:Category:Unreleased comics|has not been released]], it should be omitted. | ||
| − | * '''<code> | + | * '''<code>oglink</code>''' must always be used alongside '''<code>ogtitle</code>'''. Otherwise, chaos will ensue. They should only be used for [[LiveJournal|the early xkcd comics]], not when Randall [[:Category:Comics edited after their publication|changes the title]] of an existing comic. (Or maybe they should? That's interesting now that I think about it!) These parameters are optional. |
| − | * '''<code> | + | * '''<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 used to jump to the ==Explanation== is <code><nowiki>[[#Explanation|↓ Skip to explanation ↓]]</nowiki></code>. | ||
* '''<code>imagesize</code>''' limits the size of the image in units of pixels. This parameter is optional. | * '''<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 | + | ** To limit the width, simply list the width. E.g.: <code>350px</code> |
| − | ** To limit the height, prepend an "x" to the desired height | + | ** To limit the height, prepend an "x" to the desired height. E.g.: <code>x400px</code> |
** 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>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>custom</code>''' overrides the '''<code>image</code>''' parameter and replaces the image with the text provided. This parameter is optional. | ||
| − | * '''<code> | + | * '''<code>titletext</code>''' sets the [[Title text|title text]] of the comic. |
| − | |||
| − | * '''<code> | + | * If '''<code>number</code>''' is left undefined, at least '''<code>lappend</code>''' must be defined. The comic link will be set using "wide link mode" <sup>''[What does this mean?]''</sup>, and most of the navigation bar will be disabled. |
| − | |||
| − | |||
** '''<code>lappend</code>''' ('''L'''ink '''APPEND''') is the text that is appended to <code>xkcd.com/</code> in the link. This parameter is required when using "wide link mode". | ** '''<code>lappend</code>''' ('''L'''ink '''APPEND''') is the text that is appended to <code>xkcd.com/</code> in the link. This parameter is required when using "wide link mode". | ||
| − | ** '''<code>ldomain</code>''' ('''L'''ink '''DOMAIN''') is the subdomain of the link, defaulting to <code>www | + | ** '''<code>ldomain</code>''' ('''L'''ink '''DOMAIN''') is the subdomain of the link, defaulting to <code>www</code>. For example, if the link is to a blog post (blog.xkcd.com), '''<code>ldomain</code>''' should be set to <code>blog</code>. This parameter does not have to be explicitly set. |
| − | ** The resulting link will be | + | ** The resulting link will be: |
| + | https://'''ldomain'''.xkcd.com/'''lappend''' | ||
* '''<code>captionstyle</code>''' will set the style of the title text that appears beneath the comic via the style attribute of the span object. This parameter is optional. | * '''<code>captionstyle</code>''' will set the style of the title text that appears beneath the comic via the style attribute of the span object. This parameter is optional. | ||
* '''<code>extra</code>''' is a boolean parameter that will automatically add the page to the [[:Category:Extra comics|Extra comics category]] when it is set to <code>yes</code>. This parameter is optional. | * '''<code>extra</code>''' is a boolean parameter that will automatically add the page to the [[:Category:Extra comics|Extra comics category]] when it is set to <code>yes</code>. This parameter is optional. | ||
| + | |||
| + | == Example 1 == | ||
| + | {{comic/sandbox | ||
| + | | 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. | ||
| + | }} | ||
The example above is produced by the following code: | The example above is produced by the following code: | ||
| Line 83: | Line 74: | ||
| 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. | | 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. | ||
}}</pre> | }}</pre> | ||
| + | |||
| + | == Example 2 == | ||
| + | {{comic/sandbox | ||
| + | | number = 10 | ||
| + | | date = September 30, 2005 | ||
| + | | title = Pi Equals | ||
| + | | oglink = https://web.archive.org/web/20070927001941/http://xkcd-drawings.livejournal.com/?skip=40#:~:text=8%3A44%20pm-,Pi%20equals,-(4%20Comments | ||
| + | | ogtitle = Pi equals | ||
| + | | image = pi.jpg | ||
| + | | titletext = My most famous drawing, and one of the first I did for the site | ||
| + | }} | ||
| + | |||
| + | The example above is produced by the following code: | ||
| + | |||
| + | <pre>{{{comic | ||
| + | | number = 10 | ||
| + | | date = September 30, 2005 | ||
| + | | title = Pi Equals | ||
| + | | oglink = https://web.archive.org/web/20070927001941/http://xkcd-drawings.livejournal.com/?skip=40#:~:text=8%3A44%20pm-,Pi%20equals,-(4%20Comments | ||
| + | | ogtitle = Pi equals | ||
| + | | image = pi.jpg | ||
| + | | titletext = My most famous drawing, and one of the first I did for the site | ||
| + | }} | ||
| + | </pre> | ||
Revision as of 21:15, 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.
Usage
{{comic
| number =
| date =
| title =
| oglink =
| ogtitle =
| before =
| image =
| custom =
| imagesize =
| noexpand =
| titletext =
| ldomain =
| lappend =
}}
Notes
-
number,title, andimageare the comic number, comic title, and comic image. In normal circumstances, they should always be defined.
-
dateis the date the comic was first published and should be written in the formmmmm d, yyyy(full month name, day number without padding, 4-digit year; i.e.January 1, 2006). If the comic has no date or has not been released, it should be omitted.
-
oglinkmust always be used alongsideogtitle. Otherwise, chaos will ensue. They should only be used for the early xkcd comics, not when Randall changes the title of an existing comic. (Or maybe they should? That's interesting now that I think about it!) These parameters are 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 used to jump to the ==Explanation== is
[[#Explanation|↓ Skip to explanation ↓]].
- The wikitext used to jump to the ==Explanation== is
-
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.:
x400px - Warning: If the
imagesizeis larger than theimage, the image will be stretched.
- To limit the width, simply list the width. E.g.:
-
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. -
customoverrides theimageparameter and replaces the image with the text provided. This parameter is optional.
-
titletextsets the title text of the comic.
- If
numberis left undefined, at leastlappendmust be defined. The comic link will be set using "wide link mode" [What does this mean?], and most of the navigation bar will be disabled.-
lappend(Link APPEND) is the text that is appended toxkcd.com/in the link. This parameter is required when using "wide link mode". -
ldomain(Link DOMAIN) is the subdomain of the link, defaulting towww. For example, if the link is to a blog post (blog.xkcd.com),ldomainshould be set toblog. This parameter does not have to be explicitly set. - The resulting link will be:
-
https://ldomain.xkcd.com/lappend
-
captionstylewill set the style of the title text that appears beneath the comic via the style attribute of the span object. This parameter is optional.
-
extrais a boolean parameter that will automatically add the page to the Extra comics category when it is set toyes. This parameter is optional.
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. |
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.
}}
Example 2
| Pi Equals |
| Original title: Pi equals |
![]() Title text: My most famous drawing, and one of the first I did for the site |
The example above is produced by the following code:
{{{comic
| number = 10
| date = September 30, 2005
| title = Pi Equals
| oglink = https://web.archive.org/web/20070927001941/http://xkcd-drawings.livejournal.com/?skip=40#:~:text=8%3A44%20pm-,Pi%20equals,-(4%20Comments
| ogtitle = Pi equals
| image = pi.jpg
| titletext = My most famous drawing, and one of the first I did for the site
}}

