Search code examples
mediawikimediawiki-templates

How can I display spaces in Media Wiki Page Title but not in the URL?


How can I display spaces in Media Wiki Page Title but not in the URL?

Desired Result: if someone types in example.com/w/John1:1-5 then I'd like the page title on that page to show John 1:1-5.

I realize I could create a page at example.com/w/John_1:1-5, but I don't want users to have to type the underscore.

Is there a way to do this without creating a redirect?

Thanks!


Solution

  • You can use the DISPLAYTITLE magic word for this, e.g. {{DISPLAYTITLE:John 1:1-5}}.

    $wgAllowDisplayTitle must be set to true order to use it, and $wgRestrictDisplayTitle set to false. The former enables the feature, and the latter permits more than just letter-case changes (i.e. the display title can be anything at all, even quite different from the page title).

    If you want to display inbound links on other pages (i.e. you type [[John1:1-5]] but want it to display as John 1:1-5) then the Display Title extension can do that.