Manual:$wgNamespaceContentModels
From Linux Web Expert
<translate> Content Models and Handlers</translate> |
---|
<translate> MediaWiki allows for page content types other than wikitext.</translate> <translate> It offers built-in support for JavaScript, CSS, JSON and plain text.</translate> <translate> Extensions can use MediaWiki's ContentHandler mechanism to add new content models for accepting different formats and controlling how they are rendered, stored and edited.</translate> |
File:OOjs UI icon information.svg <translate> About</translate> |
File:Wrench font awesome.svg <translate> Usage</translate> |
|
File:OOjs UI icon advanced.svg <translate> Configuration settings</translate> |
<translate> Support and development</translate>
|
· <span style="" title="<translate nowrap> Edit this template</translate>"><translate> e</translate> |
<translate> Content handlers and storage</translate>: $wgNamespaceContentModels | |
---|---|
Content types defined for a given namespace |
|
<translate> Introduced in version:</translate> | 1.21.0 |
<translate> Removed in version:</translate> | <translate> still in use</translate> |
<translate> Allowed values:</translate> | <translate> Unspecified</translate> |
<translate> Default value:</translate> | [] |
<translate> Other settings:</translate> <translate> Alphabetical</translate> | <translate> By function</translate> |
Details
Associative array mapping namespace IDs to the name of the content model pages in that namespace should have by default (use the CONTENT_MODEL_XXX
constants).
If no special content type is defined for a given namespace, pages in that namespace will use the CONTENT_MODEL_WIKITEXT
(except for the special case of JavaScript and CSS pages).
Example
JSON
Suppose you have created a new custom namespace NS_JSON
and you want all new pages in this namespace to have JSON content and to be supported by the appropriate content handler.
Add the following to your LocalSettings.php file.
$wgNamespaceContentModels[NS_JSON] = CONTENT_MODEL_JSON;
If you already created pages in this namespace, see the talk page.