Template:File link: Difference between revisions

From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
mNo edit summary
mNo edit summary
 
(9 intermediate revisions by 2 users not shown)
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.
This template creates a file page link with [[Special:UnusedFiles]] prevention, as well as [[Special:Upload]] support if the file doesn't exist. __NOTOC__


== About ==
== About ==
This template should only be used to link to files 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 is because any files linked 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 important 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>
=== :File: vs. Media: ===
=== :File: vs. Media: ===
Both prefixes display a link instead of embedding the file itself, but there are some key differences:
Both prefixes display a link instead of embedding the file itself, but there are some key differences:
Line 27: Line 29:


== Usage ==
== Usage ==
Testing the template for bugs:
<code><nowiki>{{file link|MK8 Electrodrome Alternate Screen.png}}</nowiki></code>
:{{file link|MK8 Electrodrome Alternate Screen.png}}


{| class="wikitable"
<code><nowiki>{{file link|MK8 Electrodrome Alternate Screen.png|Alternate screen}}</nowiki></code>
! Code
:{{file link|MK8 Electrodrome Alternate Screen.png|Alternate screen}}
! [[mw:Main Page|MediaWiki]] parsing
|-
| <code><nowiki>{{media link|MK8 Electrodrome Alternate Screen.png}}</nowiki></code>
| {{{{PAGENAME}}|MK8 Electrodrome Alternate Screen.png}}
|-
| <code><nowiki>{{media link|MK8 Electrodrome Alternate Screen.png|}}</nowiki></code>
| {{{{PAGENAME}}|MK8 Electrodrome Alternate Screen.png|}}
|-
| <code><nowiki>{{media link|MK8 Electrodrome Alternate Screen.png|Test}}</nowiki></code>
| {{{{PAGENAME}}|MK8 Electrodrome Alternate Screen.png|Test}}
|-
| <code><nowiki>{{media link||Test}}</nowiki></code>
| {{{{PAGENAME}}||Test}}
|-
| <code><nowiki>{{media link||}}</nowiki></code>
| {{{{PAGENAME}}||}}
|-
| <code><nowiki>{{media link|}}</nowiki></code>
| {{{{PAGENAME}}|}}
|-
| <code><nowiki>{{media link}}</nowiki></code>
| {{{{PAGENAME}} }}
|-
| <code><nowiki>{{media link|Aeilsdfilasjdl.png}}</nowiki></code>
| {{{{PAGENAME}}|Aeilsdfilasjdl.png}}
|-
| <code><nowiki>{{media link|Aeilsdfilasjdl.png|}}</nowiki></code>
| {{{{PAGENAME}}|Aeilsdfilasjdl.png|}}
|-
| <code><nowiki>{{media link|Aeilsdfilasjdl.png|Test}}</nowiki></code>
| {{{{PAGENAME}}|Aeilsdfilasjdl.png|Test}}
|}


[[Category:Formatting templates]]</noinclude>
[[Category:Formatting templates]]</noinclude>

Latest revision as of 23:16, February 7, 2025

This template creates a file page link with Special:UnusedFiles prevention, as well as Special:Upload support if the file doesn't exist.

About

This template should only be used to link to files 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 is because any files linked 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 important 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]]

: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
Check mark.svg X mark.svg X mark.svg
Media: Media:MK8 Electrodrome Alternate Screen.png
Media:Aeilsdfilasjdl.png
X mark.svg Check mark.svg Check mark.svg

Usage

{{file link|MK8 Electrodrome Alternate Screen.png}}

File:MK8 Electrodrome Alternate Screen.pngMedia:MK8 Electrodrome Alternate Screen.png

{{file link|MK8 Electrodrome Alternate Screen.png|Alternate screen}}

Alternate screenMedia:MK8 Electrodrome Alternate Screen.png