Difference between revisions of "Help:Namespace"

From LinuxMCE
Jump to: navigation, search
(Built-in namespaces)
(How to create a new namespace)
Line 143: Line 143:
 
You can create and add custom namespaces to your wiki to further separate content and allow more logical organization.  
 
You can create and add custom namespaces to your wiki to further separate content and allow more logical organization.  
 
Create namespaces to separate your articles just as you would create folders to keep documents.<br> A custom namespace can be used to hold content that should not be shown on the search results page, for example pages that are used only for transclusion.<br>
 
Create namespaces to separate your articles just as you would create folders to keep documents.<br> A custom namespace can be used to hold content that should not be shown on the search results page, for example pages that are used only for transclusion.<br>
 +
 +
====Edit the configuration file====
 +
 +
#Open the <tt>'''/var/www/html/mediawiki/LocalSettings.php'''</tt> file
 +
#Add a line to create the new namespace:
 +
::All namespaces require a numerical index <br>
 +
::Custom namespaces are indexed starting with 100 <br>
 +
::::*Even indexes are content namespaces:
 +
::::*Odd indexes are discussion ('talk:') namespaces
 +
 +
$wgExtraNamespaces[100] = "Foo";
 +
$wgExtraNamespaces[101] = "Foo_talk";

Revision as of 00:30, 30 September 2012

Home | Editing help | Table of contents (2)



Introduction to namespaces

Namespaces: the containers

Articles in MediaWiki are placed in locations called "namespaces". Namespaces are the MediaWiki architecture components that hold all articles. The final location of an article is the one that has been specified through its title prefix following the construct Namespace:Title.
If an article is titled without the use of the optional location prefix (:Title), it is placed in the main namespace, which is the default location. This is so because the main namespace is the null character.

Why namespaces?

Namespaces are administrative boundaries used to separate content from policy and discussion.
They isolate pages based on their intended use:

  • public viewing
  • private information intended for the editing community.



When is a new namespace needed?

Mainly when a content type is to be reserved for a defined group of users. If you are a user, all you need to know is that all articles are in the "Main" namespace by default. You do not need a new namespace. Continue reading from #Where to place the article? below.



Working with namespaces

How to view the contents of a namespace

The special page "Special:Allpages" contains all the articles created in the wiki by its editors. It lists the contents of the "Main" namespace.
The "Namespace:" drop down menu on that page enables you to select a different namespace and click the "Go" button to view the articles it contains.

These work:  [[Special:Allpages]]  [[Special:Specialpages]]    [[:help]] 
These don't: [[Special:Help]][[Help:]]
[Help:] [[Special:Help:]] [[innamespace:Help]]



Where to place the article?

Before starting a new article, a decision has to be made about its intended use and audience. Each new article should be placed in the namespace that has related articles that are used for the same purpose.

Placing an article in a namespace

The final location of an article is determined through its title. The title of an article is a special structure that provides a facility to specify the destination of the article.
The construct is: Location:Title.
The location prefix specifies where the article should be located in reference to all other articles on the wiki.

Moving articles between namespaces

To move an article, all that is needed is a change of prefix (location).

How to specify the namespace(s) to search

The namespaces searched are the ones specified in the "search" section of the Preferences.

Namespace variables

The namespace is returned by {{NAMESPACE}} . On this page, it returns "Help".

{{FULLPAGENAME}} returns both the namespace and pagename as follows: "Help:Namespace"

The following does not work for this implementation but is included here for reference purposes.
List and numbers of the namespaces: http://wiki.linuxmce.org/api.php?action=query&meta=siteinfo&siprop=namespaces

Click here to view a detailed list of the namespaces in this wiki.




Namespace administration

Built-in namespaces

MediaWiki ships with 18 built-in namespaces.

The following 8 namespaces all have associated discussion namespaces.

Index Name Purpose Comments
0 Main "Real" content; articles Has no prefix
1 Talk Talk pages of "Real" content
2 User User pages
3 User talk Talk pages for User Pages
4 Project Information about the wiki Prefix is the same as $wgSitename
5 Project talk
6 File Media description pages
7 File talk
8 MediaWiki Site interface customisation Protected
9 MediaWiki talk
10 Template Template pages
11 Template talk
12 Help Help pages
13 Help talk
14 Category Category description pages
15 Category talk

2 other namespaces have negative indexes and have special purposes. You cannot create or delete pages in these namespaces, and there are no corresponding discussion namespaces.

Index Name Purpose
-1 Special Holds special pages
-2 Media Alias for direct links to media files

MediaWiki built-in namespaces

Every MediaWiki installation comes with 18 predefined namespaces. Here are a few facts about some of them:


The following 8 namespaces all have associated discussion namespaces.

Index 	Name 	        Purpose 	                Comments
0 	Main 	        "Real" content; articles 	Has no prefix
2 	User 	        User pages, personal notes
4 	Project         Information about the wiki 	Prefix is the same as $wgSitename
6 	Image           Media description pages         descriptions of uploaded files or media files
8 	MediaWiki 	Site interface customisation 	Protected
10 	Template 	Template pages
12 	Help 	        Help pages
14 	Category 	Category description pages

2 other namespaces have negative indexes and have special purposes. You cannot create or delete pages in these namespaces, and there are no corresponding discussion namespaces. Index Name Purpose -1 Special Holds special pages -2 Media Alias for direct links to media files


  • the main namespace: this is the default namespace for all pages that have no prefix in their titles.
  • the 15 special meaning prefixes:
    • project namespaces: 2 namespaces that get their names from the name of the wiki project.
      • edit this sentence , and so differ in name from one wiki to the next; on the Wikipedia, they are called Wikipedia: and Wikipedia talk:. On each wiki, these project namespaces (whatever they may happen to be for that wiki), can be referred to by the pseudonyms "Project:" and "Project Talk:", respectively.)
  • 2 pseudo-namespaces

How to create a new namespace

You can create and add custom namespaces to your wiki to further separate content and allow more logical organization. Create namespaces to separate your articles just as you would create folders to keep documents.
A custom namespace can be used to hold content that should not be shown on the search results page, for example pages that are used only for transclusion.

Edit the configuration file

  1. Open the /var/www/html/mediawiki/LocalSettings.php file
  2. Add a line to create the new namespace:
All namespaces require a numerical index
Custom namespaces are indexed starting with 100
  • Even indexes are content namespaces:
  • Odd indexes are discussion ('talk:') namespaces
$wgExtraNamespaces[100] = "Foo";
$wgExtraNamespaces[101] = "Foo_talk";