-1

I want to turn off the built in html processing of links in mediawiki. For example, I want to edit the Sidebar (MediaWiki:Sidebar) by adding a link with question marks and equal signs (i.e. Special:CustomNeed?page_title=Name+with+spaces), but the processing breaks the link to the following: Special:CustomNeed%3Fpage_title%3DName%2Bwith%2Bspaces. This way, the link doesn't work.

After reading this question, I thought there is a way to turn the processing off, however, I have no clue how. Do I have to add/edit something in the LocalSettings.php?

Community
  • 1
  • 1
EngJon
  • 927
  • 7
  • 18
  • The question you link to is about a differend issue. Somethink like `https://example.com/foo|bar` is an invalid URL, that is turned into a valid URL by percent-encoding to `https://example.com/foo%7Cbar`. Most software will do this automatically. If eample.com hates web standards and interprets `|` and `%7C` differently, you are out of your luck. (...) – Tgr Aug 01 '15 at 23:18
  • `?`, `=` and `+` are, on the other hand, entirely valid characters in an URL an MediaWiki will not encode them when it encounters them while expecting an URL. It will encode them when expecting a page name though, to suppress the special meaning they have in URLs. `https://my.site/wiki/a%3Fb` is a link to the `a?b` article, `https://my.site/wiki/a?b` is a link to the `a` article with an extra [parameter](https://www.mediawiki.org/wiki/Manual:Parameters_to_index.php). You probably want the first when you enter `[[a?b]]` so MediaWiki encodes it for you. – Tgr Aug 01 '15 at 23:22
  • Unfortunately, mediawikia (the special pages) can't deal with the converted links. But the accepted answer was exactly what I needed and helped – EngJon Aug 01 '15 at 23:22
  • Well, `Special:CustomNeed%3Fpage_title%3DName%2Bwith%2Bspaces` is a link to the special page called `CustomNeed?page_title=Name+Bwith+spaces` which of course does not exist. You want a link to the `CustomNeed` special page, with the `page_title` parameter taking the value `Name+with+spaces`. Those are different things and since most normal humans are not aware of this difference, MediaWiki tries to guess which one you mean. If you enter a link without some prefix that would make it clear it's a link (e.g. `http://`, `https://`, `//`) it will guess wrong. – Tgr Aug 01 '15 at 23:26
  • I don't doubt the correctness of your comment, but luckily, the accepted answer helps me bypass these shenaningans of mediawiki sidebar convertion. Nevertheless, thank you for your explanations ;) – EngJon Aug 01 '15 at 23:29

2 Answers2

4

You can't specify query parameters for internal links so use full URLs instead: http://example.com/wiki/Special:CustomNeed?page_title=Name+with+spaces

See Manual:Interface/Sidebar for details.

MaxSem
  • 3,242
  • 18
  • 33
  • Not the most elegant way, but this does the trick! Is it possible to alter the link according to the page title? so instead of `Name+with+spaces` I'd add the title of the current page? – EngJon Jul 30 '15 at 12:11
  • I just found out myself, {{FULLPAGENAME}} delivers the wanted result :) – EngJon Jul 30 '15 at 12:39
  • A small improvement is to use, in place of the raw link: {{fullurl:Special:CustomNeed|action_title={{FULLPAGENAME}}}} – Seb35 Jul 31 '15 at 08:56
1

You can do that by setting $wgRawHtml = true; in LocalSettings.php:

Then, you will be able to add your html links (or any code you wan't) within <html></html> tags.

Please keep in mind that it can be dangerous if your wiki is public, because people can insert any javascript code they want there.

Read more here

DanielMK
  • 431
  • 4
  • 13
  • `MediaWiki:Sidebar` is different, it's not parsed the way other pages/messages are. – MaxSem Jul 30 '15 at 04:58
  • Thank you for the answer. The answer of Max is fitting my question more, but this is good to know as well. – EngJon Jul 30 '15 at 12:13