Wynncraft Wiki
m (Protected "Template:FileUrl": High traffic page: security issue ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
(prevent caching)
 
Line 1: Line 1:
<includeonly>{{ #ifexist: File:{{PAGENAME:{{{1}}}}} }}{{ #widget: FileUrl | url = {{ #sub: {{filepath: {{PAGENAME:{{{1}}}}} | {{{2|}}} }} | {{ #len: {{ #explode: {{filepath: Wiki.png}} | b/bc/ }} }} }}{{#if: {{{query|}}} | ?{{{query}}} }} }}</includeonly><noinclude>{{doc}}</noinclude>
+
<includeonly>{{ #ifexist: File:{{PAGENAME:{{{1}}}}} }}{{ #widget: FileUrl | url = {{ #sub: {{filepath: {{PAGENAME:{{{1}}}}} | {{{2|}}} }} | {{ #len: {{ #explode: {{filepath: Wiki.png}} | b/bc/ }} }} }}?v={{CURRENTTIMESTAMP}}{{#if: {{{query|}}} | &{{{query}}} }} }}</includeonly><noinclude>{{doc}}</noinclude>

Latest revision as of 19:54, 24 March 2019

By using Widget:FileUrl, this template allows local files to be used in CSS, anywhere which url() is accepted. This is usually prevented due to the security risks of external images.

Note that the wiki doesn't count the file as being "used", and thus if there's no page which embeds the file with the normal [[File:]] syntax, it will end up in Special:UnusedFiles and may get deleted. So make sure to properly use the file somewhere, like the documentation page for the template the file is being used in.

Example

Adding a background image to text inside a link:

[[Wynncraft Wiki|<span style="padding-left:18px;background:{{FileUrl|Wiki.png|16px}} no-repeat">Wynncraft Wiki</span>]]

Wynncraft Wiki