Extension:NewArticleTemplates

Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:GPL licensed extensions
MediaWiki extensions manual
NewArticleTemplates
Release status: betaCategory:Beta status extensions
Implementation User interfaceCategory:User interface extensions
Description Prefills newly created pages with some text.
Author(s) Mathias Ertl (MathiasErtltalk)
Latest version 1.3 (2021-06-30)
MediaWiki 1.35+Category:Extensions with manual MediaWiki version
Database changes No
License GNU General Public License 3.0 or later
Download Category:Extensions in GitHub version control
Changelog
Example see below
  • $wgNewArticleTemplatesNamespaces
  • $wgNewArticleTemplatesPerNamespace
  • $wgNewArticleTemplatesDefault
  • $wgNewArticleTemlatesOnSubpages
Category:All extensionsCategory:Extensions not in ExtensionJson

The NewArticleTemplates extension allows to automatically prefill text of new pages with the contents of other predefined wiki-pages. It is possible to distinguish between namespaces and specify a different text for new subpages.

Download

Installation & Configuration

The extension is probably more configurable than it needs to be. It is recommended that you use pages in the MediaWiki namespace for the templates, otherwise the templates are editable by everyone, which is probably not what you want. Here is a (hopefully) self-explanatory snippet of LocalSettings.php:

wfLoadExtension( 'NewArticleTemplates' );

# Templates are used in these namespaces:
$wgNewArticleTemplatesNamespaces = [
        NS_MAIN                 => 1,
        100                     => 1,
        102                     => 1,
        104                     => 1,
        106                     => 1
];

# new pages in the main namespace use MediaWiki:NewArticleTemplates:
$wgNewArticleTemplatesPerNamespace = array(
        NS_MAIN                 => "MediaWiki:NewArticleTemplates",
);

# new pages in any other namespace defined by $wgNewArticleTemplatesNamespaces use MediaWiki:NewArticleTemplatesDefault:
$wgNewArticleTemplatesDefault = "MediaWiki:NewArticleTemplatesDefault";

Handling of subpages

The handling of subpages is somewhat special:

  1. A page containing a slash ('/') is only considered a subpage if the part before the first slash represents an existing article
  2. If $wgNewArticleTemplatesOnSubpages is set to true, the extensions checks for the existence of a page with the suffix "/Subpage" to the normal title of the template-page and uses it instead, if it exists.
    In the above example, a new article in the main namespace would be prefilled with MediaWiki:NewArticleTemplates, but if the new page is a subpage of an existing page, MediaWiki:NewArticleTemplates/Subpage would be used instead, if it exists.

Categories in the templates

Note that MediaWikis includeonly- and noinclude-tags are also supported in the MediaWiki-namespace.

Example

http://vowi.fsinf.at/ has the extension installed. Try creating a new page in the main namespace, the "TU Wien"-namespace and then a new subpage of a "TU Wien"-page (all pages in TU Wien).

Changelog

1.3 (2021-06-30)
  • Update for MediaWiki 1.35 and later
1.2 (2018-03-29)
  • Update for MediaWiki 1.29 and later
1.1 (rev. 187)
  • fixed a typo in the global imports
  • much refined handling of subpages
  • if the new page is a subpage and a subpage of the template named 'Subpage' exists, it is used instead
1.0
  • first version documented here

See Also

Category:Page creation extensions
Category:All extensions Category:Beta status extensions Category:EditPage::showEditForm:initial extensions Category:Extensions in GitHub version control Category:Extensions not in ExtensionJson Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:Page creation extensions Category:User interface extensions