This Forum has been archived

Forums: Admin Central Index Technical Help How do you create a page with an underscore in the title?
Central's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 1780 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

I'm trying to create pages for scripting functions. Some of them have underscores in the title. But Wikia keeps translating them into spaces. I tried to replace the underscores with %5F but that had the same effect. I tried to rename the page after the fact but Wikia told me I cannot rename a page to itself. What a bizarre problem. I'm stumped. Does anybody know how to fix this? -- Pecoes 21:55, February 24, 2012 (UTC)

You can't actually create a page like that, but you can use {{DISPLAYTITLE:Desired_name_with_underscores}} for practically the same effect. Dysrhythmia 22:11, February 24, 2012 (UTC)
Hm. Yes, that almost works. I was able to create a page that looked like it was named Cutscene_TargetMidpoint. The search was able to find that page too. Links to that page showed it as "Cutscene TargetMidpoint" however... That's no so good.
I like your suggestion but still... We're talking about a scripting language here after all. Exact spelling does matter. There's no such thing as almost correct when it comes to scripts. The compiler would not accept "Cutscene TargetMidpoint". That would not even be an unknown function. It would be a syntax error. -- Pecoes 22:38, February 24, 2012 (UTC)
Underscores are automatically replaced with spaces by MediaWiki. Searching something like "You are a walrus" and "You_are_a_walrus" will always end up with the same page, and any links to "You_are_a_walrus" will go to "You are a walrus". There's no way to stop if from doing so. kerri (w) 22:42, February 24, 2012 (UTC)
{{DISPLAYTITLE:}} is the closest you will get to what you are wanting. It's a limitation in the MediaWiki software. The same is true about creating pages with ] or [ in the title. Rappy 22:45, February 24, 2012 (UTC)
Being the stubborn sort I tried a few other things but ultimately I have to admit: You're right. All of you. It's just not possible.
I've resorted to a hack now. I'll append "()" to all function names which gives me the option to easily find their links. Then I'll rewrite them with JavaScript:
$(function() {
    $('a').filter(function () {
        return /\(\)$/.test($(this).html());
    }).html(function (index, oldhtml) {
        return oldhtml.replace(/ +/, '_');
Pecoes 05:59, February 25, 2012 (UTC)