Commons:File captions

File captions are a feature part of Structured data (the first part to be enabled). They are meant to store short, multilingual descriptions about files. See mw:Help:File captions for more information. They were enabled on Wikimedia Commons in January 2019.

What makes a good caption?

There are technical requirements (limited to 255 characters in length, and cannot contain markup) which necessarily make captions short.

FAQ

How is this different from descriptions?

Captions are meant to be simple and short. While descriptions can be very expansive, captions are limited to 255 characters in length, and cannot contain markup (like Wikitext links or HTML) and do not support external links.

Captions are available as part of our structured data, while descriptions are not. In technical terms, a description is plain wikitext wrapped in a language template, wrapped again in an Information template ; while captions are Wikibase labels. As such, they will be searchable through the API, making it easy to find/filter/pull captions from files as metadata.

Conversely, on Pluto-01 Stern 03 Pluto Color TXT.jpg there is a very extensive description (858 characters, and links) and the caption is much shorter (more or less the same caption used on the Wikipedia articles using that image).

Can't I (or a bot) simply copy descriptions into captions?

Firstly, caption are shorter than many descriptions; they cannot contain links, nor wiki-markup.

While it may be possible to copy short pieces of text from a description to a caption, this needs human interpretation.

Only text which is so short that it is not copyrightable should be copied into captions, as captions are published under a CC0 ("public domain") waiver.

What are the benefits of captions?

One of the core benefit is improved language-aware searchability. Classical file descriptions are in the wikitext, and are only searchable through full-text search, which necessarily searches through the entire page contents, including categories and license templates ; and it is not possible to do search search per language. As they are searchable via the API, it is easier for 3rd party reusers to find and reuse media and the captions themselves.

Other possible usages can be:

filling in infoboxes

query files for missing captions in a given language

building lists for translation of important files needing a caption localized for a project or campaign

Where are captions stored?

How can I search by caption?

Users can search for files by their MediaInfo captions just as they would search for anything else. For example, if a user uploads a picture of the Eiffel Tower, and enters ‘Tour Eiffel’ (French) and ‘Eiffel Tower’ (English) as multilingual file captions, the picture is findable by another user searching for either ‘Eiffel Tower’ or ‘Tour Eiffel’.

How can I query the captions using Lua/templates

This is not documented yet, but should be soon − stay tuned.

How can I set captions at upload time?

Adding captions in the Upload Wizard.

You can already fill-in captions when uploading using the Upload Wizard. You can pre-fill a caption with url-parameters caption and captionlang when calling the Upload Wizard via link e.g. in the context of an upload campaign.

Show caption in collapsed mode

With the gadget Collapse Captions you will in collapsed mode by default only see an empty box apart from the Expand string. The following will make the caption visible in this state (i.e. Captions in your language):

Because of the method, how the line numbers are inserted here in the presentation, in the copy of the rules you will see every second line being empty. You can safely delete these empty lines, if you want. There is actually some indentation with a tab character, too, which is also not shown here.This is valid for the following rules with line numbers below, as well.

Line 1: In tests the part !important was necessary. This will provoke a warning here in Commons in the code editor of common.css. Maybe it could be even left out when this file is used (tested only with browser addon).

Line 2: This will remove the header (Structured data in your language). If you want to have it displayed instead, delete this line including the comma.

Lines 10–12 are for formatting of the visible caption. If you want to have the default upright, bold string, delete these lines.

Lines 13–14: You probably need in most cases only either of these two rules, though it doesn’t matter if you copy them both. To decide which one you usually will need look at their beginning:

.ltr: left-to-right writing systems like Latin script (e.g. English).

.rtl: right-to-left writing systems like Arabian script.

If you want to have the default string at beginning (left for ltr, right for rtl systems), delete these lines.

Line 15 is only needed for rtl systems. It sends the toggle for collapsing and decollapsing to the left of the page. This rule will be active also for every toggle on all other Commons pages.

Further styling just for appearance, add this below the rules from above:

Line 1: If the ellipsis inside of content: " …"; is not in the usual style of your language then replace it according to your taste, but do not omit the quote signs! If the added content is on the wrong side in your writing system then replace after with before.

Lines 2–5 are for the caption in uncollapsed mode. If you don’t want it to be underlined then delete line 4.

More compact collapsed mode

… but not that compact like with the gadget Compact Captions

With lower resolutions this will interfere with the preceding preview and size information for all files where the MediaViewer is not present (i. e. all files not of filetype image). See first note below.

Lines 4–5: If you do not want to have parentheses around the edit string (Edit in your language) either delete both rules or replace them with your preferred characters inside of content: "…";, but do not omit the quote signs!