Walter Jessen

Discovery New Media

Create a Page from the MediaWiki Sidebar

MediaWiki sidebar - create page

I’ve been using MediaWiki a lot lately to organize and archive information. MediaWiki provides several ways to start a new page; typically, the wiki’s URL is used. The URL to an article of the wiki is usually something like this:

http://www.example.com/index.php/ARTICLE

or

http://www.example.com/wiki/ARTICLE

When you navigate to a page that doesn’t exist, you can either click on the “Create” tab or the “edit this page” link to create a new page.

New pages can also be created from the search results page after searching for a page that doesn’t exist. In either case however, from the wiki URL or the search results page, there are several clicks required before you can actually start typing into a text box to create a page.

One of the things I’ve never understood is why there isn’t a “create page” input box above the search box on the MediaWiki sidebar. Especially during the early development of a wiki, page creation is going to be much more frequent than searching. I’ve been using the Inputbox MediaWiki extension, which adds HTML forms to wiki pages. The extension can be configured to provide a form to create a new page. However, it only works on a wiki page, not the sidebar.

I wasn’t able to find a solution online, so I figured out how to do it myself. Here’s how to add a form to create a new page on the MediaWiki sidebar.

Difficulty level: Easy Requirements: write access to a MediaWiki installation

Look for the following lines of code in MonoBook.php (or whichever skin file you’re currently using). For MonoBook.php (MediaWiki 1.15.3 installation), the lines are 255 and 256.

<h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
<div id="searchBody" class="pBody">

Insert the following five lines of code:

<form action="http://www.example.net/index.php" method="get">
<input name="title" value="" size="15" type="text" />
<input name="action" type="hidden" value="edit" />
<input type="submit" value="Create" />
</form>

Note that you’ll need to determine how your particular MediaWiki installation is configured to handle the URL and you may have to modify the first line.

After making the above changes, you may have to bypass your browser’s cache to see the changes. Firefox and Safari users: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on a Mac); Internet Explorer users: install Firefox or Safari.


Categorized as Productivity  
Tagged as , , , , ,

2 Comments

  1. Hey, thanks a lot, just installed MediaWiki and found out there was no “create page” button, how annoying!

  2. Cool, thanks. It works nicely for me too.

    From reading around trying to find a solution to this, I came to suspect that the MediaWiki people did this “omission” of a “create page” link or button on purpose. Paraphrasing and interpreting what I read in one of their FAQ or Help pages, the idea seems to be that creating a page from a link inside of a previously existing article is preferred, because then you have no question about the need for the new article and its appropriateness to the general context of all the other pages present in the system.

    Of course, as you mentioned, that logic falls flat on its face in a new Wiki system, where there isn’t much to link from to begin with.

    Anyway, it would be nice to have the choice in an official and well integrated way. In my case, for example (a private wiki for lab information), most pages are loose and not linked to any others, so having “create page” on the side bar is quite a time saver.

    Thanks again J

TopHome