Jump to content

Template:File/doc

From Wikipedia, the free encyclopedia

This template is a quick way to sanitize filename strings, which ensures they are always formatted as File: and will work with embedding syntax.

For example, say a template takes an image parameter. Should it be Dog.jpg or File:Dog.jpg? You could make everyone read the documentation, or you could clutter up your own template with extra code, or you could use this.

Cheap and easy (it only uses a single PAGENAME magic word call).

{{file|File:Dog.jpg}} File:Dog.jpg
{{file|Dog.jpg}} File:Dog.jpg
{{file|Image:Dog.jpg}} File:Dog.jpg
{{file|File:The Dog File: Woofs Of The Dog Still.jpg}} File:The Dog File: Woofs Of The Dog Still.jpg
{{file|Image:The Dog File: Picture This Image: Woofs Of The Dog Still.jpg}} File:The Dog File: Picture This Image: Woofs Of The Dog Still.jpg
{{file|The Dog File: Picture This Image: Woofs Of The Dog Still.jpg}} File:The Dog File: Picture This Image: Woofs Of The Dog Still.jpg

Bizarre edge-cases where a file's name itself starts with "File:" are not going to work properly (I don't even know if it's possible to upload these, but if you do, then don't).

{{file|File:File:File:How To Remove Metal From A File: The Hard Way.pdf}} File:File:File:How To Remove Metal From A File: The Hard Way.pdf