Template:comic category

explain xkcd: It's 'cause you're dumb.
Jump to navigation Jump to search

Helper function for {{comic}}.

Puts this page in categories by number. The padding ensures that #9 comes before #10. It otherwise sorts 'alphanumerically'; since the first character of "10" is "1", it would normally be placed before "9" even though it should be placed after. The padding turns each into 0009 and 0010 etc. Now, since "0" is less than "1", #9 gets sorted before #10.

Only categorizes if the page is in the main namespace, and not the Main Page nor the extra comics.

Exact structure[edit]

<!--    
    {{#ifeq:                               ** Compare
       {{FULLPAGENAME}}                       * the page rendered
       |                                   ** with
       {{int:mainpage}}                       * the mainpage identity
       |                                   ** if it IS that, then
                                              * do nothing
       |                                   ** else
       {{#ifexpr:                             ** an expression check of
              {{{extra|}}}                       * is the comic numbered?
              |                               ** if it is
              {{DEFAULTSORT:                     * we set the default sorting order as
                     {{padleft:{{{number}}}|4}}}}  * the comic number padded to 4 digits
              }}
       }}
       {{#ifeq:                               ** a new comparison of
              {{{extra|}}}                       * "extra=" , if exists
              |                               ** with
              yes                                * the word "yes"
              |                               ** if was "extra=yes"
              [[Category:Extra comics]]          * add one category
              [[Category:All pages]]             * and another
              |                               ** else
                                                 * ...
                                     'normal' comic things -->