0

I have a mediawiki template which contains the following code: (there is more, but this is the part relevant to the question)

[[{{#if:{{{page|}}}|{{{page|}}}|{{{ns|}}}{{{1}}}}}]]

I tried to use it where {{{ns}}} is :Category:, but the first colon on :Category: creates an automatic newline (see https://meta.wikimedia.org/wiki/Help:Newlines_and_spaces#Automatic_newline).

How can I fix this template so it correctly creates the link without the automatic newline?

I tried adding <nowiki/> before {{{ns|}}}, but then I got a plain text link ([[:Category:ParameterOne]]) instead of a linkified link

john
  • 1,156
  • 9
  • 22

1 Answers1

0

Fortunately I didn't need to add the initial colon in :Category:, so I was able to solve this by simply adding the colon at the beginning of the link inside the Template.

I.e. I passed Category: (without a colon as a prefix) as the parameter {{{ns}}}, and changed the code to:

[[{{:#if:{{{page|}}}|{{{page|}}}|{{{ns|}}}{{{1}}}}}]]

Simply adding a colon before the #if. Fortunately all other namespaces worked the same as before.

john
  • 1,156
  • 9
  • 22