Difference between revisions of "Template:comic/doc"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
(making documentation more concise)
(grabbing some undocumented parameters from the template)
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>number</code>''', '''<code>title</code>''', and '''<code>image</code>''' are the comic number, comic title, and comic image.
  
 
* '''<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>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>titletext</code>''' sets the [[Title text|title text]] of the comic.
  
 
* '''<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 (e.g.: "350px").
 
** 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"
+
** 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.
  
Line 61: Line 63:
 
* '''<code>custom</code>''' overrides the '''<code>image</code>''' parameter and replaces the image with the text provided. 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.
  
* 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, the comic link will be set using "wide link mode"; at least '''<code>lappend</code>''' must be defined if '''<code>number</code>''' is undefined.
** '''<code>lappend</code>''' ('''L'''ink '''APPEND''') is the text that is appended to <code>xkcd.com/</code> in the link.
+
** '''<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>. It is placed before <code>.xkcd.com/</code>
+
** '''<code>ldomain</code>''' ('''L'''ink '''DOMAIN''') is the subdomain of the link, defaulting to <code>www</code>. It is placed before <code>.xkcd.com/</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.
*** For example, if the link is to a blog post (blog.xkcd.com), '''<code>ldomain</code>''' can be defined as <code>blog</code>.
 
 
** The resulting link will be <code>'''ldomain'''.xkcd.com/'''lappend'''</code> whenever '''<code>number</code>''' is undefined.
 
** The resulting link will be <code>'''ldomain'''.xkcd.com/'''lappend'''</code> whenever '''<code>number</code>''' is undefined.
 +
 +
* '''<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.
  
 
The example above is produced by the following code:
 
The example above is produced by the following code:

Revision as of 20:42, 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
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.

Example 2

Barrel - Part 1
Don't we all.Original caption: He's fairly upbeat about the situation!
Title text: Don't we all.

Original caption: He's fairly upbeat about the situation!
Warning: Default sort key "0001" overrides earlier default sort key "3048".

Usage

{{comic
| number    =
| date      =
| title     =
| before    =
| image     =
| custom    =
| imagesize =
| noexpand  =
| titletext =
| ldomain   =
| lappend   =
}}

Notes

  • number, title, and image are the comic number, comic title, and comic image.
  • date is the date the comic was 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 for 2006-1-1)
  • 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.: "x350px")
    • Warning: If the imagesize is larger than the image, the image will be stretched.
  • noexpand is 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.
  • before 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 [[#Explanation|↓ Skip to explanation ↓]].
  • custom overrides the image parameter and replaces the image with the text provided. This parameter is optional.
  • If number is left undefined, the comic link will be set using "wide link mode"; at least lappend must be defined if number is undefined.
    • lappend (Link APPEND) is the text that is appended to xkcd.com/ in the link. This parameter is required when using "wide link mode".
    • ldomain (Link DOMAIN) is the subdomain of the link, defaulting to www. It is placed before .xkcd.com/. For example, if the link is to a blog post (blog.xkcd.com), ldomain should be set to blog. This parameter does not have to be explicitly set.
    • The resulting link will be ldomain.xkcd.com/lappend whenever number is undefined.
  • captionstyle 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.
  • extra is a boolean parameter that will automatically add the page to the Extra comics category when it is set to yes. This parameter is optional.

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