Template:Clean URL

From stencil.wiki
Revision as of 21:43, 8 January 2025 by IssuePress (talk | contribs)

This template cleans up the display of external URLs, to simplify how they are shown on the wiki.

Usage

The URL should be passed as the only parameter of template. While the link itself will remain unchanged, the protocol, subdomains of www, and trailing slashes will all be cut from the text displayed.

{{clean URL|https://www.riso.co.jp/}}

Expression error: Unrecognized punctuation character "[".


Pattern recognition

Certain domains are recognized by this template, with custom simplification. This template can be edited to facilitate additional pattern matches as needed.

Instagram

{{clean URL|https://www.instagram.com/risokagaku/}}

@risokagaku


Archive.org

{{clean URL|https://web.archive.org/web/19990508115212/http://www4.mediagalaxy.co.jp/riso/}}

[archived]


Known issues

This template is primarily used to process URLs which are themselves parameters from other templates—it's usually called in a format like {{clean URL|{{{1}}}}}. However, when it is called directly on a URL, if that address contains protected MediaWiki characters like | and = (very common in URLs with parameters) it will break the template call. In these cases you must first escape these characters.

TemplateData

An external URL display simplifier.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
URL1

The URL to clean

URLrequired