Search code examples
htmlcssmediawikiright-to-leftwiki

Redirect user to Hebrew Wikipedia if no such article exists in my personal MediaWiki website


I wish to create a Wiki syntax template that will redirect a user to Hebrew Wikipedia if no such linked article exists in my personal MediaWiki website.

I tried this code

Template body:

<a href="https://he.wikipedia.org/wiki/{{urlencode:{{{1}}}|PATH}}">{{{1}}}</a><noinclude>
[[category:דוגמה]]
</noinclude>

Template call (example):

{{העברה|קרח (כימיה)}}

The template seems to work but it's output is very messy:

<a href="https://he.wikipedia.org/wiki/%D7%A7%D7%A8%D7%97%20%28%D7%9B%D7%99%D7%9E%D7%99%D7%94">קרח (כימיה</a>

How to prevent the output from being messy?


Solution

  • Try

    <a href="https://he.wikipedia.org/wiki/{{urlencode:{{{1}}}|PATH}}">{{{1}}}</a>
    

    ? See details at https://www.mediawiki.org/w/index.php?title=Help:Magic_words#URL_data