Difference between revisions of "Template:comic/doc"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
(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__
== 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.
 
}}
 
 
== Example 2 ==
 
{{comic/sandbox
 
| number    = 1
 
| date      = September 30, 2005
 
| title    = Barrel - Part 1
 
| oglink    = https://web.archive.org/web/20070927001941/http://xkcd-drawings.livejournal.com/?skip=40#:~:text=8%3A38%20pm-,Barrel,-He%27s%20fairly%20upbeat
 
| ogtitle=    Barrel
 
| image    = barrel_cropped_(1).jpg
 
| titletext = Don't we all.<br><br><span class="plainlinks">[https://web.archive.org/web/20070927001941/http://xkcd-drawings.livejournal.com/?skip=40#:~:text=8%3A38%20pm-,Barrel,-He%27s%20fairly%20upbeat Original caption</span>]: He's fairly upbeat about the situation!
 
}}
 
 
 
== 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>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>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>titletext</code>''' sets the [[Title text|title text]] of the comic.
+
* '''<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 (e.g.: "350px").
+
** 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.: "x350px")
+
** 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>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.
+
* '''<code>titletext</code>''' sets the [[Title text|title text]] of the comic.
** 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, 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.
 
 
* 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. 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>. 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.
+
** '''<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 <code>'''ldomain'''.xkcd.com/'''lappend'''</code> whenever '''<code>number</code>''' is undefined.
+
** 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, and image are the comic number, comic title, and comic image. In normal circumstances, they should always be defined.
  • date is 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. (Or maybe they should? That's interesting now that I think about it!) These parameters are 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 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 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.
  • custom overrides the image parameter and replaces the image with the text provided. This parameter is optional.
  • If number is left undefined, at least lappend must 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 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. 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:
https://ldomain.xkcd.com/lappend
  • 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.

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