Adding simple content to MediaWiki


Introduction

This is a brief follow-up my earlier posting on creating a personal wiki. Hopefully this posting will help show just how easily wiki content can be added. No need for client side word processors or fancy html editors, publishing software or the like. You simply just access the site and start typing. You don’t even have to log on unless the site administrator (here: you!) requires it. By default anyone can edit page contents which is half the point.

Creating your first document

Create new pageSo if you followed my earlier posting you should now have an empty MediaWiki based installation running. The natural starting point is to either import data into it or create pages by hand. Both are possible, but I will focus on the latter. If you are like me, your first thought will probably be to look for the “Create new page” button. However, you won’t find one! The way to add pages to MediaWiki is to either point your browser to the new wiki page address or use the search box on the left hand side of the wiki site main page. The easiest method is to use the search box and type a page title, preferably something longer than 3 characters (by default MySQL doesn’t index words of 3 characters and below) and then press the “Go” button.

If the page does not exist you will be presented with a page stating that “There is no page titled ‘My Page title’. You can create this page”. If the page does exist then it will be opened, as expected. Assuming the former scenario, press the linked text “create this page” to create a new page with your given title. You should now be ready to add content.

The way the wiki works may appear a little backwards at first, but the general idea is to first use a reference to something before actually creating the actual referred to object. In this case you are referring to a page that does not yet exist so the wiki complies by asking you if you want to create it. We will see the same behavoir later when creating internal page links, categories and the like. You simply assume they exist and refer to them as if they do.

Formatting options

So you have created a page. Pretty simple, but what about content? Well, again it’s really just as simple. You just have to start typing into the large editor field in the middle of the screen. However, to make you pages look pretty, you might want to pick up a trick or two along the way.

Text formatting

There is not much to say really. You create italic text by surrounding it with 2 apaostrophe characters on either side of the text, like:

”this text is bold”

    You create bold text by surrounding it with 3 apostrophe characters on each side of the text:

    ”’this text is bold”’

      A combination of both bold and italic can be created by increasing the number of surrounding apostrophe characters to 5:

      ””’this text is both bold and italic””’

        Headings

        You create a title heading by surrounding it with an equal number of equals characters (=) on either side of the heading, so for instance

        = My title =
        == My title ==
        === My title ===
        ==== My title ====

        and so on. This corresponds loosely to the h1, h2, h3 etc. tags familiar from html. You can add up to 6 equals characters on either side before the actual equals characters start to show up as part of the heading label. You must make sure that the number of equals characters is the same on both sides of the heading label or else they willWiki titles show up as part of the label itself. The thumbnail image on the right illustrates how the headings will appear on the page. Also notice the content box at the top of the page. It appears automatically once you have added more than 3 headings on a page. Notice also the last heading containing more than 6 equal characters as they now appear in the heading label. This is probably not what you want. In most cases you will find yourself only needing two or three heading sizes per page. If you find yourself running out then maybe you should be considering splitting the contents into several wiki pages and linking them together using internal links.

        Creating links (external and internal)

        You create a link to an internal wiki page by referring to the page title in double square brackets, like

        [[link to my page]]

        where ‘link to my page’ is the actual title of an existing or non-existing page in the wiki. If the page does not exist then the user will be asked if he would like to create a page with the given title. This is in fact the same procedure used when we created our first page earlier. In this way the wiki grows by letting a page refer to non-existent pages for others to fill in the blanks. It is really quite clever and the exact opposite of how a normal web site usually works. You can change the link label by adding a pipe character between the page title and desired label, so for instance

        [[link to my page | preferred label]]

        will add an internal link to a page named ‘link to my page’, but will display the link text ‘preferred label’ instead of the given page title.

        External links are a little bit different. You type a URL in the same double square brackets like so

        [[http://www.wordpress.com]]

        Here the actual URL will be displayed as the wiki page link label. However, in most cases you will want to give it a more user friendly label. You do so by simple adding the desired label after the URL like

        [[http://www.wordpress.com WordPress]]

        Now the link will show up labeled ‘WordPress’. There is no pipe character as before, just a space. Since URL’s can’t contain the space character this works out fine.

        Creating categories

        Categories help structure the content in the wiki. You can assign a page to an unlimited number of different categories and like before, they do not need to exist beforehand. A page’s categories appears at the bottom of the page (see figure)

        Page categoriesCreating a category is very simple. When in edit mode on a page you want to categorize you simple type the category name in square brackets, prepending the category name with the label ‘Category:’, so

        [[Category:Your category name here]]

        So [[Category:PHP]] would assign the given wiki page to the PHP category. To add the page to more categories simply add more [[Category:whatever]] declarations.

        Summary

        I’ll leave it at that for now. That should get you started creating pages with simple content, linking them together and categorizing them in a logical structure.

        Advertisements

        2 thoughts on “Adding simple content to MediaWiki

        1. OK, so it’s fairly (or very) easy to create pages and populate them with info in MediaWiki.

          But, and this is the MediaWiki-challenge of the day, how do you create an article whose title starts with a lower case letter — for example “eXist XML DB”? 😉

        Leave a Reply

        Fill in your details below or click an icon to log in:

        WordPress.com Logo

        You are commenting using your WordPress.com account. Log Out / Change )

        Twitter picture

        You are commenting using your Twitter account. Log Out / Change )

        Facebook photo

        You are commenting using your Facebook account. Log Out / Change )

        Google+ photo

        You are commenting using your Google+ account. Log Out / Change )

        Connecting to %s