Difference between revisions of "Template:comic/doc"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
Line 3: Line 3:
 
----
 
----
  
'''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.
+
'''The template {{tl|comic}} 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 ==
Line 10: Line 10:
 
| date      =
 
| date      =
 
| title    =
 
| title    =
 +
| ognumber  =
 
| oglink    =
 
| oglink    =
 +
| titlewhat =
 
| ogtitle  =
 
| ogtitle  =
 +
| ogprev    =
 +
| ognote    =
 +
| ognext    =
 
| before    =
 
| before    =
 
| image    =
 
| image    =
Line 26: Line 31:
 
}}</pre>
 
}}</pre>
  
'''<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.
+
{| class="wikitable"
 
+
! Parameter
'''<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.
+
! Description
 
+
|-
'''<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>number</code>'''
 
+
| The comic number. In normal circumstances, this should always be defined.
'''<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>title</code>'''
'''<code>imagesize</code>''' limits the size of the image in units of pixels. This parameter is optional.
+
| The comic title. In normal circumstances, this should always be defined.
* To limit the width, simply list the width. E.g.: <code>350px</code>
+
|-
* To limit the height, prepend an "x" to the desired height. E.g.: <code>x400px</code>
+
| '''<code>image</code>'''
* Warning: If the '''<code>imagesize</code>''' is larger than the '''<code>image</code>''', the image will be stretched.
+
| The comic image. In normal circumstances, this should always be defined.
 
+
|-
'''<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>date</code>'''
 
+
| 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>custom</code>''' overrides the '''<code>image</code>''' parameter and replaces the image with the text provided. This parameter is optional.
+
|-
 
+
| '''<code>oglink</code>'''
'''<code>titletext</code>''' sets the [[Title text|title text]] of the comic. '''<code>ttstyle</code>''' ('''t'''itle '''t'''ext '''style''') will set the style of '''<code>titletext</code>''' that appears beneath the comic via the style attribute of the span object. This parameter is optional.
+
| 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. These parameters are optional.
 
+
|-
'''<code>bodystyle</code>''' and '''<code>bodyclass</code>''' also do something.
+
| '''<code>ogtitle</code>'''
 
+
| Must always be used alongside '''<code>oglink</code>'''. These parameters are optional and meant for early xkcd comics.
'''<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>before</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.
+
| 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>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>. 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.
+
| '''<code>imagesize</code>'''
* The resulting link will be:
+
| Limits the size of the image in units of pixels. This parameter is optional.<br />* To limit the width, simply list the width. E.g.: <code>350px</code><br />* To limit the height, prepend an "x" to the desired height. E.g.: <code>x400px</code><br />* Warning: If the '''<code>imagesize</code>''' is larger than the '''<code>image</code>''', the image will be stretched.
https://'''ldomain'''.xkcd.com/'''lappend'''
+
|-
 +
| '''<code>noexpand</code>'''
 +
| 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>titletext</code>'''
 +
| Sets the [[Title text|title text]] of the comic.
 +
|-
 +
| '''<code>ttstyle</code>'''
 +
| Sets the style of '''<code>titletext</code>''' that appears beneath the comic via the style attribute of the span object. This parameter is optional.
 +
|-
 +
| '''<code>bodystyle</code>'''
 +
| Sets the inline CSS style of the outer body wrapper of the comic template. This parameter is optional.
 +
|-
 +
| '''<code>bodyclass</code>'''
 +
| Sets the HTML class attribute of the outer body wrapper of the comic template. This parameter is optional.
 +
|-
 +
| '''<code>extra</code>'''
 +
| 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>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". If '''<code>number</code>''' is undefined, at least this must be defined.
 +
|-
 +
| '''<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 is optional. The resulting link when using <code>lappend</code> and optionally <code>ldomain</code> is:<br />
 +
<code>https://'''ldomain'''.xkcd.com/'''lappend'''</code>
 +
|}
  
 
== Example 1 ==
 
== Example 1 ==

Revision as of 17:47, 22 April 2025

This page WILL BE transcluded into Template:comic as its documentation. (once the changes are approved by an admin)


The template {{comic}} 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     =
| ognumber  =
| oglink    =
| titlewhat =
| ogtitle   =
| ogprev    =
| ognote    =
| ognext    =
| before    =
| image     =
| custom    =
| imagesize =
| noexpand  =
| titletext =
| ttstyle   =
| bodystyle =
| bodyclass =
| extra     =
| ldomain   =
| lappend   =
}}
Parameter Description
number The comic number. In normal circumstances, this should always be defined.
title The comic title. In normal circumstances, this should always be defined.
image The comic image. In normal circumstances, this should always be defined.
date The date the comic was first published and should be written in the form mmmm 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.
oglink Must always be used alongside ogtitle. Otherwise, chaos will ensue. They should only be used for the early xkcd comics, not when Randall changes the title of an existing comic. These parameters are optional.
ogtitle Must always be used alongside oglink. These parameters are optional and meant for early xkcd comics.
before 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 ↓]].
imagesize 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.: x400px
* Warning: If the imagesize is larger than the image, the image will be stretched.
noexpand A boolean parameter indicating whether the "Click comic to enlarge" button is hidden, usually used when imagesize is limiting the size of the comic. To hide the button, set this to true. This parameter is optional.
custom Overrides the image parameter and replaces the image with the text provided. This parameter is optional.
titletext Sets the title text of the comic.
ttstyle Sets the style of titletext that appears beneath the comic via the style attribute of the span object. This parameter is optional.
bodystyle Sets the inline CSS style of the outer body wrapper of the comic template. This parameter is optional.
bodyclass Sets the HTML class attribute of the outer body wrapper of the comic template. This parameter is optional.
extra A boolean parameter that will automatically add the page to the Extra comics category when it is set to yes. This parameter is optional.
lappend (link append) is the text that is appended to xkcd.com/ in the link. This parameter is required when using "wide link mode". If number is undefined, at least this must be defined.
ldomain (link domain) is the subdomain of the link, defaulting to www. For example, if the link is to a blog post (blog.xkcd.com), ldomain should be set to blog. This parameter is optional. The resulting link when using lappend and optionally ldomain is:

https://ldomain.xkcd.com/lappend

Example 1

Suspension Bridge
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.
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
My most famous drawing, and one of the first I did for the site
Title text: My most famous drawing, and one of the first I did for the site
Warning: Default sort key "0010" overrides earlier default sort key "3048".

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
}}

Tests

Air Fact
'Wow, that must be why you swallow so many of them per year!' 'No, that's spiders. You swallow WAY more ants.'
Title text: 'Wow, that must be why you swallow so many of them per year!' 'No, that's spiders. You swallow WAY more ants.'
Warning: Default sort key "3070" overrides earlier default sort key "0010".
Suspension Bridge
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.
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.
Warning: Default sort key "3048" overrides earlier default sort key "3070".


Pi Equals
My most famous drawing, and one of the first I did for the site
Title text: My most famous drawing, and one of the first I did for the site
Warning: Default sort key "0008" overrides earlier default sort key "3048".
Pi Equals
My most famous drawing, and one of the first I did for the site
Title text: My most famous drawing, and one of the first I did for the site
Warning: Default sort key "0010" overrides earlier default sort key "0008".