Template:File link: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<includeonly>{{#ifexist:File:{{{1}}}|[[:File:{{{1}}}{{#if:{{{2|}}}|{{!}}{{{2}}}}}]]<span style="display:none">}}[[Media:{{{1}}}{{#ifexist:File:{{{1}}}||{{!}}{{#if:{{{2|}}}|{{{2}}}|File:{{{1}}}}}}}]]{{#ifexist:File:{{{1}}}|</span>}}</includeonly><noinclude> | <includeonly>{{#ifexist:File:{{{1}}}|[[:File:{{{1}}}{{#if:{{{2|}}}|{{!}}{{{2}}}}}]]<span style="display:none">}}[[Media:{{{1}}}{{#ifexist:File:{{{1}}}||{{!}}{{#if:{{{2|}}}|{{{2}}}|File:{{{1}}}}}}}]]{{#ifexist:File:{{{1}}}|</span>}}</includeonly><noinclude> | ||
This template creates a file page link with [[Special:UnusedFiles]] prevention, as well as [[Special:Upload]] support if the file doesn't exist. __NOTOC__ | This template creates a file page link with [[Special:UnusedFiles]] prevention, as well as [[Special:Upload]] support if the file doesn't exist. __NOTOC__ | ||
This template should only be used to link to a file needed for article or project purposes but not needed as an embed. For example, an image linked in an article reference tag to support a claim. The reason for this because any file linked to using this template will never appear on [[Special:UnusedFiles]]. In the case of the reference tag image, this makes sense, since its usage as a reference is a valid purpose and we don't want it to be deleted as long as that link exists. But if two files link to each other as "other versions" using this template, then those two files are now immune from ever showing as unused, even if neither of them has a single link or embed outside of the File namespace. In this case, we actually do want the files to be tracked by [[Special:UnusedFiles]] if they're not used anywhere on the wiki, so this template should not be used. In most cases outside of mainspace, the use of this template should be avoided and a regular file link used instead: <code><nowiki>[[:File:Example.png|file link]]</nowiki></code> | |||
== About == | == About == |
Revision as of 10:00, January 17, 2025
This template creates a file page link with Special:UnusedFiles prevention, as well as Special:Upload support if the file doesn't exist.
This template should only be used to link to a file needed for article or project purposes but not needed as an embed. For example, an image linked in an article reference tag to support a claim. The reason for this because any file linked to using this template will never appear on Special:UnusedFiles. In the case of the reference tag image, this makes sense, since its usage as a reference is a valid purpose and we don't want it to be deleted as long as that link exists. But if two files link to each other as "other versions" using this template, then those two files are now immune from ever showing as unused, even if neither of them has a single link or embed outside of the File namespace. In this case, we actually do want the files to be tracked by Special:UnusedFiles if they're not used anywhere on the wiki, so this template should not be used. In most cases outside of mainspace, the use of this template should be avoided and a regular file link used instead: [[:File:Example.png|file link]]
About
:File: vs. Media:
Both prefixes display a link instead of embedding the file itself, but there are some key differences:
Prefix | Sample | Provides a file page link | Special:UnusedFiles prevention | Provides a special link to Special:Upload if a red link has been detected |
---|---|---|---|---|
:File:
|
File:MK8 Electrodrome Alternate Screen.png File:Aeilsdfilasjdl.png |
|||
Media:
|
Media:MK8 Electrodrome Alternate Screen.png Media:Aeilsdfilasjdl.png |
Usage
{{file link|MK8 Electrodrome Alternate Screen.png}}
{{file link|MK8 Electrodrome Alternate Screen.png|Alternate screen}}
Testing for bugs
Code | MediaWiki parsing |
---|---|
{{file link|MK8 Electrodrome Alternate Screen.png}}
|
File:MK8 Electrodrome Alternate Screen.png |
{{file link|MK8 Electrodrome Alternate Screen.png|}}
|
File:MK8 Electrodrome Alternate Screen.png |
{{file link|MK8 Electrodrome Alternate Screen.png|Test blue link}}
|
Test blue link |
{{file link|Aeilsdfilasjdl.png}}
|
File:Aeilsdfilasjdl.png |
{{file link|Aeilsdfilasjdl.png|}}
|
File:Aeilsdfilasjdl.png |
{{file link|Aeilsdfilasjdl.png|Test red link}}
|
Test red link |
{{file link|}}
|
[[Media:|File:]] |
{{file link||}}
|
[[Media:|File:]] |
{{file link||Test link}}
|
[[Media:|Test link]] |
{{file link}}
|
[[Media:{{{1}}}|File:{{{1}}}]] |