This page is semi-protected against editing.


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


Documentationview · edit · history · purge ]
This documentation is transcluded from Template:F/doc.

Establishes a link to the file whose name is given in parameter #1 and displays the name without the prefix "File:".
Instead of the file name, any text given in parameter #2 can be displayed.
The file itself (the image) can be displayed at any size inline, after the name or left of it.

Additional possibilities:

  • It is possible to avoid the link and display the plain name of parameter #1 (or parameter #2).
  • It is possible to avoid any display of the name but display the image.
  • The displayed image can be surrounded by a border.

Besides of these standard usages exist possibilities for extended usage, see below.


{{F |1= }}

The parameters "n" and "l" allow better formatting, e.g. to get equal-wide rows when arranging several lines with displayed images — see the two examples.

Template parameters

1file name: name of the file, with or without namespace; or *
underscores contained in the filename are replaced by spaces
2display name: any text[1]. Default is the file name (parameter #1)
underscores contained in the display name are displayed
3pixel size: numeric value. The picture is displayed inline in this size [2]emptyoptional
4b[1] (lowercase B) to draw a border around the displayed pictureemptyoptional
5!l[1] (lowercase L) to display the image left of the file name
r[1] (lowercase R) to display the image to the rightmost
6n[1] (lowercase N) to display the name not-linking to the fileemptyoptional
7±[1] ("+" or "-" sign) to display the file name with the namespace "File:"emptyoptional
8Z[1] (uppercase Z) to suppress the display of the file nameemptyoptional
9File Function Letter[1][3]: different functions can be performedemptyoptional
t=any text string, used between displayed file name and displayed image
Use uppercase T= to precede the string with a space
p=a prefix to be written in advance; e.g. p=<div/> for a new lineemptyoptional
l=language code (ISO 639), if the file is in another Wikipedia [2]
may specify e.g. "l=b:es" for an image of the Spanish Wikibooks,
or e.g. "l=s:it" for image Pallot1.svg in Italian Wikisource
lang=language code (ISO 639), to display a translated version when
the SVG file contains translations using SVG <switch> elements.
by=can be used to display the user who created the file (see examples)emptyoptional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

See also

Some templates using {{F}} can display an unlimited number of files, names and/or images, with possibly other display names and many other modifying parameters:

  • {{ Filelist }} – displays horizontally an unlimited number of files: {{ Filelistfilename 1filename 2filename 3 }}
  • {{ Other versions }} – to display vertically an unlimited number of files, e.g. in the Other versions= field
  • {{ File }} – displays horizontally an unlimited number of files, after the internationalized text "File:"
  • {{ Derived from }} – displays vertically, after text
  • {{ Derivative versions }} – displays vertically, after text


This template is not intended to be localized.


Standard usage

Syntax Code Example
{{ Ffile name }} {{F|SVG_Simple_Icon.svg}} SVG Simple Icon.svg is the simplest form; it displays the file name as a link to the file.
{{ Ffile nameany text }} {{F|SVG_Simple_Icon.svg|example}} example displays the text string of the 2nd parameter as a link to the file.
{{ Ffile namesize }} {{F|SVG_Simple_Icon.svg||16}} SVG Simple Icon.svgSVG Simple Icon.svg displays first the file name, and then the image in size px[2]
{{ Ffile nameany textsize }} {{F|SVG_Simple_Icon.svg|SVG|16x16}} SVGSVG Simple Icon.svg is the same but any text is displayed instead of the file name.

When parameter 1 contains an asterisk (the value * ) instead of the file name, that will be replaced by the {{PAGENAME}}; this is possible only in the file namespace.

Extended usage

When with a "size" in parameter #3 the image display is requested, with the parameters explained there additional formatting can be performed.
The one-letter parameters can be specified in any sequence with every parameter #4 to #7 or #2, e.g 4=b and 6=l.

  • b draws a border around the image. This can be useful to show the extensions of the image.
  • l displays the image left of the name. This option allows a better formatting, e.g. when more files are displayed in a list and the file names are of different length:
    {{ Ffile namesizel }} (or {{F|file name|l|size}}) to display the file left of the name.
  • r displays the image to the right (has precedence over code l). E.g. {{ FSolid green.svgr16T = → → → }} will show rightmost Solid green.svg → → →
    Solid green.svg
  • n: Independent whether the image is displayed or not, the parameter n let display plain text instead of the link. This is sometimes useful for better formatting.
Note: n can as well be specified with every parameter #4 to #7. When no display of the image is required, n can also be specified with parameter #3; when parameter #2 is not needed for a display text, n can even be specified with parameter #2 (to distinguish a text of one character from a one-character-code, the text may need to be expanded e.g. with <nowiki/>).
{{ Ffile nameany textsizebln }} is an example for usage of these formatting characters - the sequence does not matter.
  • u: It would hae been nice to have also an option "u" – show the file name below of ("under") the displayed picture. But it seems very difficult to do this in all the different conditions, and the gallery function or the template:G is well equipped for that.
  • +: Independent whether the image is displayed or not, the plus sign can be used to prefix the file name display with the namespace.
No translation occurs, "File:" is used. {{ FExample.svg+12 }} displays File:Example.svgExample.svg, the name space as a part of the link.
With the minus sign - the name space is not a part of the link: {{ FExample.svgl12- }} displays Example.svg File:Example.svg.
The name space option seems not very useful with a display name (parameter #2) but it is possible to define it that way: {{ FExample.svgTest12+ }} will display File:TestExample.svg
If as well a + and a - sign are mistakenly defined, the - is ignored.
Note: Some odd combinations of + or - with n are currently not working properly, esp. with n as parameter 3. Use another, better working parameter sequence if so.
  • t=: When the image is displayed either left or right of the displayed file name, with t= any text can be defined to separate the two items. It will replace the default separator :&nbsp; (or &nbsp; with option l).
  • Z: When an image should be displayed without showing the file name, this can be achieved by setting the character "Z". Parameter #1 specifies the file name, parameter #3 the size; therefore Z can be set by either parameter #4 to #7 or the not needed parameter #2. Of course it is of no use to combine Z with n, l or r but it won't do any harm.
    E.g. the sequence {{ FRzz 10.svgZ10b }}{{ FRzz 10.svgb16Z }}{{ FRzz 10.svg }} will show Rzz 10.svgRzz 10.svgRzz 10.svg
{{ F }} 0 no name without parameter #1: error display & categorization
{{ FYes_check.svg }} Yes check.svg only link
{{ FYes check.svgn }}[4] Yes check.svg only name - without link
{{ FYes check.svg16b }}[4] Yes check.svgYes check.svg bordered
{{ FYes check.svg16l }}[4] Yes check.svg Yes check.svg 0 left of name (as in "other versions" of File:Symbol unrelated.svg.)
{{ FYes check.svg16n }}[4] Yes check.svg: Yes check.svg no link (as in "other versions" of File:Arrow-C.svg.)
{{ FYes check.svg16r }}[4] Yes check.svg
Yes check.svg
rightmost display, with file name
{{ FYes check.svgr16Z }}
Yes check.svg
rightmost display of image, without file name

Examples for the by parameter

{{ FYes check.svg-12by = Gmaxwell }} → File:Yes check.svgYes check.svg by User:Gmaxwell
{{ FX mark.svg-by = {{ut|Anybody||de}} of {{wd}} }} → File:X mark.svg by Anybody of de:Wp

Language codes

The named parameter l= enables interwiki access. Files in any Wikipedia, Wikisource, Wikibooks etc can be addressed by a link, but it is not possible to display images from outside of Commons due to technical restrictions.

The named parameter lang= allows to use the language switch option:
The file France Population Pyramid-2010.svg contains many languages. With {{ FFrance Population Pyramid-2010.svg112lang = xx }} the translated versions can be shown:

Diagram rendered in ArabicFrance Population Pyramid-2010.svg Diagram rendered in VietnameseFrance Population Pyramid-2010.svg Diagram rendered in KoreanFrance Population Pyramid-2010.svg
Diagram rendered in JapaneseFrance Population Pyramid-2010.svg Diagram rendered in RussianFrance Population Pyramid-2010.svg Diagram rendered in HebrewFrance Population Pyramid-2010.svg

File Function Letters

This option is completely different from the description above, a value is returned instead of displaying something. By invoking the Module:File various functions can be performed. While parameter #1 specifies the file, the File Function Letter must be specified with parameter #2 or #3. Such a FFL has precedence, additional parameter settings are ignored.
Except of the mere string operations F, X and U, for files outside the commons none of the File Functions can be performed.

FFL function returned result
0C count number of file pages
0D date work date, formatted yyyy-mm-dd
0F file name name without .extension   {{F|F}}
0X extension extension without name.
0U extension extension as-it-is, case sensitive
0I ifexist "true" if file exists
0S size file size in bytes
0H height height in pixel
0W width width in pixel
0V valid? error count from W3C validation
0P page size size of file description page in bytes
0G gallery gallery style display, see below

When a file name is enough desriptive that it could be used in the file description without alteration, the function {{F|F}} can be used, e.g. |description={{en|{{F|F}}.}}

On the other hand it can be a useful abbreviation, to specify the own name with {{F|*}}.

Example: Buddhist rainbow flag.svg  file name: Buddhist flag (SVG file, nominally 450 × 300 pixels, file size: 625 bytes; description: 641 bytes.)

Example: ''{{subst:F|{{PAGENAME}}|F}}'' in the description of the above file will give: Buddhist rainbow flag; a short form can be used:

Gallery style

With the File Function Letter "G" a gallery-like display can be achieved. Different possibilities exist:

{{ Ffile nameG }} like <gallery> file name | file name </gallery> centered
{{ Ffile name0G }} like <gallery> file name </gallery>
{{ Ffile namecaptionG }} like <gallery> file name | caption </gallery> centered
{{ Ffile nameGcaption }} like <gallery> file name | caption </gallery>

The minus sign can be used to display the name space "File:"

{{ Ffile nameG.- }} like <gallery> file name | File:file name </gallery> centered
{{ Ffile name-.G }} like <gallery> file name | File:file name </gallery>

The gallery style function of template:F can be useful to display just only one file.
Display of more files is possible, but it is easier to do with the gallery template:G

where the file names can be separated also with linefeeds, or/and with "|" pipes.
To display more than one picture, write e.g. or with Template:{{G}}
{{F|Pink check.svg {{G|Pink check.svg
Purple check.svg Purple check.svg
Yellow check.svg Yellow check.svg
Red check.svg|G|16x24}} Red check.svg|d=48}}

{{F| {{G|
Pink check.svg{{!}}capt 1 Pink check.svg|capt 1
Purple check.svg{{!}}capt 2 Purple check.svg|capt 2
Yellow check.svg{{!}}capt 3 Yellow check.svg|capt 3
Red check.svg{{!}}capt 4 Red check.svg|capt 4
|G|32}} |w=32}}

Style attributes can be used, e.g.

<div style=";text-align:center;font-size:large">{{F|WWWWWWWWWWW {{G|
Test.gif{{!}}{{F|Test.gif}} Test.gif
Test.svg{{!}}{{F|Test.svg}} Test.svg
Test.pdf{{!}}{{F|Test.pdf}} Test.pdf
|G}}</div> |s=float:left}}

See also Other versions templates.


  1. a b c d e f g h Parameter #1 can only hold the filename; an alternate text can only be passed with parameter #2, and the display-size only with parameter #3.
    Other codes are not fixed to a parameter position.
    Anyone of the codes (b, n, l, r, +, -, Z) can be passed in any sequence, each one as an argument for one of the parameters either #2, #4, #5, #6, #7 or #8: {{F|X.jpg||16|b|l|n}} is equivalent to {{F|X.jpg|n|16|l|b}}.
    "b", "n", "l" or "r" may even be coded at the position of parameter #3 when no pixel size is specified there, or of parameter #2 when no text is passed.
    When it is required to display a text of one character equal to "b", "n", "l", "r", "+", "-", "Z" or a FFL it can be distinguished from such a code by an expansion, e.g. with <nowiki/>.
  2. a b c The size may be e.g. 96 or x64 or 60x16. It is not possible to display images of other Wikipedias - only when the files are stored in the Commons!
  3. A File Function Letter can be passed only with parameter either #2 or #3.
  4. a b c d e The option can as well be written immediately with parameter #2