I am trying to pass a simple mwurl to a template, but this doesn't seem to work always.
Template:U:
my link: {{{1}}}
Calling code:
{{U|[https://www.istaria-lexica.de/index.php?title=User:Elteria_Shadowhand/sandbox&action=edit test link]}}
If I use google.com instead, the template works. I assume there's some problem with special characters? What am I doing wrong?
The problem is with the equal sign in the URL. It has a special meaning in the template parametre syntax: what is on the left of the equal sign is treated as the parametre's name, what is on the right, its value.
You can either:
{{U|1=[https://www.istaria-lexica.de/index.php?title=User:Elteria_Shadowhand/sandbox&action=edit test link]}}
,{{=}}
: {{U|[https://www.istaria-lexica.de/index.php?title{{=}}User:Elteria_Shadowhand/sandbox&action{{=}}edit test link]}}
.In addition:
my link: [{{{1}}} {{{2}}}]
,{{fullurl:User:Elteria Shadowhand/sandbox|action=edit}}
or, better, {{localurl:User:Elteria Shadowhand/sandbox|action=edit}}
. The boilerplate code can be moved to the template definition as well: Template:U = [{{localurl:{{{1}}}|action=edit}} {{{2}}}]
, called with {{U|User:Elteria Shadowhand/sandbox|test link}}
,{{FULLPAGENAME}}
: Template:U = [{{localurl:{{FULLPAGENAME}}|action=edit}} {{{1}}}]
, called as {{U|test link}}
,[{{localurl:{{FULLPAGENAME}}|action=edit}} test link]
, called as {{U}}
, or Template:U = [{{localurl:{{FULLPAGENAME}}|action=edit}} {{FULLPAGENAME}}]
, also called as {{U}}
, or Template:U = [{{localurl:{{{1}}}|action=edit}} {{{1}}}]
, called as {{U|User:Elteria Shadowhand/sandbox}}
.