User:Aristeas/Photo ID

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

A personal template for use with my photographs. This template generates an extension of the standard {{Information}} box in order to display the ID of the photograph in my archive. It also uses auto-categorization to sort the image file automatically into Category:Photographs by Aristeas - by name, Category:Photographs by Aristeas - by ID and into the appropriate subcategory of Category:Photographs by Aristeas - by date.

This template should be used directly below the general {{Information}} template; if we don’t add a blank line in between, the new box is visually merged with the {{Information}} box. If the standard {{Location}} or {{Location withheld}} template is also used, it should go between the other templates, i.e. the best order is {{Information}}, {{Location}}, finally this template.


  1. My personal photo ID (a short string). Very useful for my personal reference, so please do not delete this parameter if present!
  2. Date in ISO format, i.e. YYYY-MM-DD, without the time and without any additional whitespace, please.
    • If this value is provided, it is used to sort the image automatically into the appropriate subcategory of Category:Photographs by Aristeas - by date.
    • For some old photographs, the exact date is unknown; in this case use just the year (YYYY) for this parameter, again without any additional whitespace.
    • If the date is completely unknown, omit this parameter; this sorts the photo automatically into Category:Photographs by Aristeas - without date.

Some minor hints about the implementation[edit]

  • In earlier versions I used (like in the code for the original {{Information}} template) a <div> around the complete <table> element: <div class="hproduct commons-file-information-table"> ... </div>. But the {{Location}} template does not use that <div> at all, so we can omit it.
  • Seems that for the <table> the single class="toccolours" is sufficient. But the {{Information}} and {{Location}} templates add more classes, so I add all the classes used by the {{Location}} template, too.
  • The <table> element in the standard {{Information}} still uses the attributes dir, lang and cellpadding, so we use them, too (but I wonder if this is really good 21st-century HTML?).
  • In order to get the spacing right and to allow several information supplement tables to be merged visually with the {{Information}} template, we must avoid empty lines and even some line breaks in our template code. For example, there must be no newline between </includeonly> and <noinclude>, and it seems that we must even avoid line breaks between the various included category definitions. Else the MediaWiki software thinks that we want a break after our table and adds a nasty <p><br/></p> (or similar) after it.
  • The code which splits the date into year and month/day in order to sort the photograph into the appropriate subcategory of Category:Photographs by Aristeas - by date uses some common Lua functionality. For more information, see the documenation of Module:String.

Template preview[edit]

Personal photo ID
(No ID assigned to this photograph.)