Meta:URL manipulations

From protonation
Jump to navigation Jump to search
VLC.svg Under construction

This page is under construction. Please come back in a few days


Anatomy of a URL

protocol site directory structure filename extension parameters
subdomain
subdomain domain
domain tld
http :// blog . example.co . uk /cars/red/ menu . php ?lang=fr
if omitted
http is implied
if omitted
www is implied
Mandatory if omitted
/ (root) is implied

Template:Remove http from URL

Removes "http(s)://" if exists

{{#ifeq: {{lc:{{#sub:{{{1}}}|0|7}}}} | http://
| {{#sub:{{{1}}}|7}}
| {{#ifeq: {{lc:{{#sub:{{{1}}}|0|8}}}} | https:// <!--
-->| {{#sub:{{{1}}}|8}} <!--
-->| {{{1}}} <!--
-->}}
}}

Example:

  • {{remove http from URL|http://www.example.com}} --> www.example.com

Template:Truncate URL

Requires Template:Remove http from URL

Truncates a URL to a given length while converts it to a working link

[{{{1}}} {{#sub:{{remove http from URL | 1 = {{lc: {{{1}}} }} }} | 0 | {{{length}}} }}...]

Example:

  • {{truncate URL|http://www.example.com|length=9}} --> www.examp...

Template:Basic URL

{{#explode:{{#ifeq: {{lc:{{#sub:{{{1}}}|0|7}}}} | http://
| {{#sub:{{{1}}}|7}}
| {{#ifeq: {{lc:{{#sub:{{{1}}}|0|8}}}} | https://<!--
-->| {{#sub:{{{1}}}|8}}<!--
-->| {{{1}}}<!--
-->}}
}}|/|0}}

Template:Remove www

Requires Template:Basic URL

{{#ifeq: {{lc:{{#sub:{{Basic URL|1={{{1}}}}}|0|4}}}} | www.
| {{#sub:{{Basic URL|1={{{1}}}}}|4}}
| {{Basic URL|1={{{1}}}}}
}}

Template:Domain only

Requires Template:Remove www

{{lc:{{#explode:{{remove www|1={{{1}}}}}|.|-2}}}}

Template:Webpage format

Requires

  • Template:Domain only
  • Template:Truncate URL
{{#switch: {{Domain only|{{{1}}}}}
| facebook = [[File:Facebook icon.jpg|16px]] [{{lc:{{{1}}}}} Facebook]
| twitter = [[File:Twitter logo initial.png|16px]] [{{lc:{{{1}}}}} Twitter]
| myspace = [[File:Myspace icon.jpg|16px]] [{{lc:{{{1}}}}} MySpace]
| google = [[File:Google plus.svg|16px]] [{{lc:{{{1}}}}} Google+]<!-- θέλει ένα if γιατί είναι plus.google.com -->
| linkedin = [[File:Linkedin icon.svg|16px]] [{{lc:{{{1}}}}} LinkedIn]
| blogspot = [[File:Blogger.svg|16px]] [{{lc:{{{1}}}}} Blogger]
| wordpress = [[File:Wordpress-logo-simple.png|16px]] [{{lc:{{{1}}}}} Wordpress]
| tumblr = [[File:Tumblr.svg|16px]] [{{lc:{{{1}}}}} Tumblr]
| youtube = [[File:18x14 Video Clic Player.svg|16px]] [{{lc:{{{1}}}}} YouTube]
| vimeo = [[File:Vimeo.svg|16px]] [{{lc:{{{1}}}}} Vimeo]
| flickr = [[File:Flickr.svg|16px]] [{{lc:{{{1}}}}} Flickr]
| 500px = [[File:500px.jpg|16px]] [{{lc:{{{1}}}}} 500px]
| picasa = [[File:Picasa.svg|16px]] [{{lc:{{{1}}}}} Picasa]<!-- θέλει ένα if γιατί είναι plus.google.com -->
| deviantart = [[File:Deviantart.svg|16px]] [{{lc:{{{1}}}}} deviantART]
| soundcloud = [[Αρχείο:Icon soundcloud.png|16px]] [{{lc:{{{1}}}}} SoundCloud]
| reverbnation = [[File:ReverbNation.jpg|16px]] [{{lc:{{{1}}}}} ReverbNation]
| last = [[File:Lastfm.svg|16px]] [{{lc:{{{1}}}}} LastFM]<!-- θέλει ένα if γιατί είναι last.fm -->
| dropbox = [[Αρχείο:Dropbox.png|16px]] [{{lc:{{{1}}}}} Dropbox]<!-- ;;;; -->
| google = [[File:Logo of Google Drive.png|16px]] [{{lc:{{{1}}}}} Google Drive]<!-- θέλει ένα if γιατί είναι plus.google.com -->
| imdb = [[File:IMDb.gif|16px]] [{{lc:{{{1}}}}} IMDb]
| [[File:Emblem-web.svg|16px]] {{truncate URL|1={{lc:{{{1}}}}}|length=25}}
}}