Difference between revisions of "Template:comic/doc"
(chatgpt helped, feel free to edit) |
|||
| Line 31: | Line 31: | ||
}}</pre> | }}</pre> | ||
| − | {| class="wikitable" | + | {| class="wikitable sortable" |
! Parameter | ! Parameter | ||
| + | ! Usage | ||
! Description | ! Description | ||
|- | |- | ||
| '''<code>number</code>''' | | '''<code>number</code>''' | ||
| − | | The comic | + | | Required in normal circumstances |
| + | | rowspan="3" | The comic's basic information. In normal circumstances, these should always be defined. | ||
|- | |- | ||
| '''<code>title</code>''' | | '''<code>title</code>''' | ||
| − | | | + | | Required in normal circumstances |
|- | |- | ||
| '''<code>image</code>''' | | '''<code>image</code>''' | ||
| − | | | + | | Required in normal circumstances |
|- | |- | ||
| '''<code>date</code>''' | | '''<code>date</code>''' | ||
| − | | The date the comic was first published and should be written in the form <code>mmmm d, yyyy</code> ( | + | | Optional; omit if unreleased or undated |
| + | | 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 digit padding, 4-digit year. Example: <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>oglink</code>''' | | '''<code>oglink</code>''' | ||
| − | | Must always be used | + | | rowspan="2" | Optional; only used for early comics |
| + | | rowspan="2" | Must always be used together for [[LiveJournal|the early xkcd comics]], not when Randall [[:Category:Comics edited after their publication|changes the title]] of an existing comic. Note that if <code>ognumber</code> is given, all parameters except <code>ognote</code> are required. | ||
|- | |- | ||
| '''<code>ogtitle</code>''' | | '''<code>ogtitle</code>''' | ||
| − | |||
|- | |- | ||
| '''<code>before</code>''' | | '''<code>before</code>''' | ||
| − | | 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>. | + | | Optional; used for long comics |
| + | | 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]] or for the comic itself if it's just text like [[Blue Eyes]]. 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>''' | | '''<code>imagesize</code>''' | ||
| − | | Limits the size of the image in | + | | Optional; limits image display size |
| + | | Limits the size of the image in pixels. | ||
| + | *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><br /> | ||
| + | Note that, if the '''<code>imagesize</code>''' is larger than the '''<code>image</code>''', the image will be stretched. | ||
|- | |- | ||
| '''<code>noexpand</code>''' | | '''<code>noexpand</code>''' | ||
| − | | | + | | Optional; used when imagesize limits display |
| + | | Boolean to hide the "Click to enlarge" button, usually when using '''<code>imagesize</code>'''. | ||
|- | |- | ||
| '''<code>custom</code>''' | | '''<code>custom</code>''' | ||
| − | | | + | | Optional; overrides image |
| + | | Replaces the comic image with custom text or content. | ||
|- | |- | ||
| '''<code>titletext</code>''' | | '''<code>titletext</code>''' | ||
| + | | Optional; sets title text | ||
| Sets the [[Title text|title text]] of the comic. | | Sets the [[Title text|title text]] of the comic. | ||
|- | |- | ||
| '''<code>ttstyle</code>''' | | '''<code>ttstyle</code>''' | ||
| − | | Sets the style of '''<code>titletext</code>''' | + | | Optional; styles title text |
| + | | Sets the CSS style of the '''<code>titletext</code>''' span element. | ||
|- | |- | ||
| '''<code>bodystyle</code>''' | | '''<code>bodystyle</code>''' | ||
| − | | Sets the inline CSS style of the outer | + | | Optional; sets wrapper style |
| + | | Sets the inline CSS style of the outer comic container. | ||
|- | |- | ||
| '''<code>bodyclass</code>''' | | '''<code>bodyclass</code>''' | ||
| − | | Sets the HTML class attribute of the outer | + | | Optional; sets wrapper class |
| + | | Sets the HTML class attribute of the outer comic container. | ||
|- | |- | ||
| '''<code>extra</code>''' | | '''<code>extra</code>''' | ||
| − | | | + | | Optional; boolean |
| + | | When set to <code>yes</code>, adds the page to the [[:Category:Extra comics|Extra comics]] category. | ||
|- | |- | ||
| '''<code>lappend</code>''' | | '''<code>lappend</code>''' | ||
| − | | | + | | Required if <code>number</code> is missing |
| + | | The part of the link appended to <code>xkcd.com/</code> in "wide link mode". Required when <code>number</code> is not set. | ||
|- | |- | ||
| '''<code>ldomain</code>''' | | '''<code>ldomain</code>''' | ||
| − | | | + | | Optional; changes link domain |
| + | | Sets the subdomain for the link (e.g., <code>blog</code> for blog.xkcd.com). Defaults 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>. The resulting link when using <code>lappend</code> and optionally <code>ldomain</code> is:<br /> | ||
<code>https://'''ldomain'''.xkcd.com/'''lappend'''</code> | <code>https://'''ldomain'''.xkcd.com/'''lappend'''</code> | ||
|} | |} | ||
| Line 166: | Line 183: | ||
| title = Pi Equals | | 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 | | oglink = https://web.archive.org/web/20070927001941/http://xkcd-drawings.livejournal.com/?skip=40#:~:text=8%3A44%20pm-,Pi%20equals,-(4%20Comments | ||
| − | |||
| image = pi.jpg | | image = pi.jpg | ||
| titletext = My most famous drawing, and one of the first I did for the site | | titletext = My most famous drawing, and one of the first I did for the site | ||
Revision as of 18:02, 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 | Usage | Description |
|---|---|---|
number
|
Required in normal circumstances | The comic's basic information. In normal circumstances, these should always be defined. |
title
|
Required in normal circumstances | |
image
|
Required in normal circumstances | |
date
|
Optional; omit if unreleased or undated | The date the comic was first published and should be written in the form mmmm d, yyyy. (Full month name, day number without digit padding, 4-digit year. Example: January 1, 2006). If the comic has no date or has not been released, it should be omitted.
|
oglink
|
Optional; only used for early comics | Must always be used together for the early xkcd comics, not when Randall changes the title of an existing comic. Note that if ognumber is given, all parameters except ognote are required.
|
ogtitle
| ||
before
|
Optional; used for long comics | 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 or for the comic itself if it's just text like Blue Eyes. 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
|
Optional; limits image display size | Limits the size of the image in pixels.
Note that, if the |
noexpand
|
Optional; used when imagesize limits display | Boolean to hide the "Click to enlarge" button, usually when using imagesize.
|
custom
|
Optional; overrides image | Replaces the comic image with custom text or content. |
titletext
|
Optional; sets title text | Sets the title text of the comic. |
ttstyle
|
Optional; styles title text | Sets the CSS style of the titletext span element.
|
bodystyle
|
Optional; sets wrapper style | Sets the inline CSS style of the outer comic container. |
bodyclass
|
Optional; sets wrapper class | Sets the HTML class attribute of the outer comic container. |
extra
|
Optional; boolean | When set to yes, adds the page to the Extra comics category.
|
lappend
|
Required if number is missing
|
The part of the link appended to xkcd.com/ in "wide link mode". Required when number is not set.
|
ldomain
|
Optional; changes link domain | Sets the subdomain for the link (e.g., blog for blog.xkcd.com). Defaults to www. For example, if the link is to a blog post (blog.xkcd.com), ldomain should be set to blog. The resulting link when using lappend and optionally ldomain is:
|
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
}}
Tests
| Air Fact |
Title text: 'Wow, that must be why you swallow so many of them per year!' 'No, that's spiders. You swallow WAY more ants.' |
| 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. |
| Pi Equals |
| Original title: Hello there |
![]() Title text: My most famous drawing, and one of the first I did for the site |
| Pi Equals |
| Original title: Pi equals |
![]() Title text: My most famous drawing, and one of the first I did for the site |

