Jump to content

Template:Remove file prefix/doc

From Wikipedia, the free encyclopedia

This is the current revision of this page, as edited by Adam Cuerden (talk | contribs) at 02:03, 28 March 2023. The present address (URL) is a permanent link to this version.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

This template removes the File: and Image: prefixes from file names.

Examples

{{remove file prefix|Example.svg}} → Example.svg

{{remove file prefix|File:Example.svg}} → Example.svg

{{remove file prefix|FILE:Example.svg}} → Example.svg

{{remove file prefix|Image:Example.svg}} → Example.svg

{{remove file prefix|IMAGE:Example.svg}} → Example.svg

{{remove file prefix|Other:Example.svg}} → Other:Example.svg

This technically works for any valid namespace, but is rarely needed there:

{{remove file prefix|Portal talk:Example.svg}} → Example.svg

It will also strip interwiki links:

{{remove file prefix|:Commons:Example.svg}} → Example.svg

{{remove file prefix|commons:Example.svg}} → Example.svg

{{remove file prefix|:sv:Example.svg}} → Example.svg

However, it will fail for more complicated situations:

{{remove file prefix|:sv:File:Example.svg}} → File:Example.svg


See also

[edit]