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
 
(21 intermediate revisions by 4 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>
==Usage==
This template creates a file page link with [[Special:UnusedFiles]] prevention, as well as [[Special:Upload]] support if the file doesn't exist. __NOTOC__
Template idea for the prefix <code>Media:</code>.


===Media: vs. :File:===
== About ==
Both prefixes display a link instead of embedding the image itself but there are some key differences:
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: ===
Both prefixes display a link instead of embedding the file itself, but there are some key differences:


{| class="wikitable"
{| class="wikitable"
! Prefix
! Prefix
! Sample
! Sample
! Provides a file page link
! [[Special:UnusedFiles]] prevention
! [[Special:UnusedFiles]] prevention
! Provides a file page link
! Provides a special link to [[Special:Upload]] if a [[red link]] has been detected
! Provides a special link to [[Special:Upload]] if [[red link]] is detected
|-
|-
! <code>Media:</code>
! <code>:File:</code>
| [[Media:MK8 Electrodrome Alternate Screen.png]]<br>[[Media:aeilsdfilasjdl.png]]
| [[:File:MK8 Electrodrome Alternate Screen.png]]<br>[[:File:Aeilsdfilasjdl.png]]
| [[File:Check mark.svg|25px]]
| [[File:Check mark.svg|25px]]
| [[File:X mark.svg|25px]]
| [[File:X mark.svg|25px]]
| [[File:Check mark.svg|25px]]
| [[File:X mark.svg|25px]]
|-
|-
! <code>:File:</code>
! <code>Media:</code>
| [[:File:MK8 Electrodrome Alternate Screen.png]]<br>[[:File:aeilsdfilasjdl.png]]
| [[Media:MK8 Electrodrome Alternate Screen.png]]<br>[[Media:Aeilsdfilasjdl.png]]
| [[File:X mark.svg|25px]]
| [[File:X mark.svg|25px]]
| [[File:Check mark.svg|25px]]
| [[File:Check mark.svg|25px]]
| [[File:X mark.svg|25px]]
| [[File:Check mark.svg|25px]]
|}
|}


That's what this template addresses by bring the best of both worlds together. This template should be used in '''main articles only'''!
== Usage ==
<code><nowiki>{{file link|MK8 Electrodrome Alternate Screen.png}}</nowiki></code>
:{{file link|MK8 Electrodrome Alternate Screen.png}}


===Use Cases===
<code><nowiki>{{file link|MK8 Electrodrome Alternate Screen.png|Alternate screen}}</nowiki></code>
{{tem|media link}} testing for bugs:
:{{file link|MK8 Electrodrome Alternate Screen.png|Alternate screen}}
{| class="wikitable"
! [[mediawiki.org:Main Page|MediaWiki]] parsing
! 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|}}</nowiki></code>
|-
! {{{{PAGENAME}}|MK8 Electrodrome Alternate Screen.png|test}}
| <code><nowiki>{{media link|MK8 Electrodrome Alternate Screen.png|test}}</nowiki></code>
|-
! {{{{PAGENAME}}||test}}
| <code><nowiki>{{media link||test}}</nowiki></code>
|-
! {{{{PAGENAME}}||}}
| <code><nowiki>{{media link||}}</nowiki></code>
|-
! {{{{PAGENAME}}|}}
| <code><nowiki>{{media link|}}</nowiki></code>
|-
! {{{{PAGENAME}} }}
| <code><nowiki>{{media link}}</nowiki></code>
|-
! {{{{PAGENAME}}|aeilsdfilasjdl.png}}
| <code><nowiki>{{media link|aeilsdfilasjdl.png}}</nowiki></code>
|-
! {{{{PAGENAME}}|aeilsdfilasjdl.png|}}
| <code><nowiki>{{media link|aeilsdfilasjdl.png|}}</nowiki></code>
|-
! {{{{PAGENAME}}|aeilsdfilasjdl.png|test}}
| <code><nowiki>{{media link|aeilsdfilasjdl.png|test}}</nowiki></code>
|}


===Other===
[[Category:Formatting templates]]</noinclude>
Uses <code>{{tem|!}}</code>. Also hides media prefix usage with <nowiki><span></nowiki> tag and a simple CSS code. Special code implemented if a red link results from the file string specified.
[[Category:Formatting templates]]
[[Category:Media 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