Extension:PlaceNewSection

From Linux Web Expert

MediaWiki extensions manual
PlaceNewSection
Release status: stable
Implementation Extended syntax
Description Controls placement of new sections
Author(s) Nx, Ernstkm
MediaWiki 1.35+
License GNU General Public License 2.0 or later
Download
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the PlaceNewSection extension if it is available at translatewiki.net

The PlaceNewSection extension introduces two magic words, __ADDNEWSECTIONBELOW__ and __ADDNEWSECTIONABOVE__, that control placement of new talk page sections.

Usage

Where __ADDNEWSECTIONBELOW__ is placed within a page, sections created from the "Add topic" tab appear directly below.
This is the opposite of MediaWiki's default behavior, which is to add new sections at the very end of the article. The effect of using this magic word in the article's lead section is to put newly-added sections in reverse-chronological order; that is, newer sections at the top, older sections at the bottom. This can be useful for journal entries or meeting minutes, where you would prefer the latest updates to be at the top of the page.
Where __ADDNEWSECTIONABOVE__ is placed within a page, new sections will be added directly above.
This is similar to the MediaWiki default behavior for talk pages, except anything below this magic word will stay at the bottom. This is useful, for example, to keep "See also" or "References" sections below any other comments on a talk page.

Note that existing sections are not reordered at the moment you add (or remove) the magic word. You would need to reorder any existing sections manually.

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/PlaceNewSection</tvar>|Download]] and move the extracted <tvar name=name>PlaceNewSection</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PlaceNewSection
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'PlaceNewSection' );
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Caveats

The magic words provided by this extension don't seem to work in a transclusion.[1]

If you had this content, for example, in a template named "newsectiontop"

__TOC__ __NEWSECTIONLINK__ __ADDNEWSECTIONBELOW__

and transcluded it into and article's lead section like this

{{newsectiontop}}

…the magic words controlling the table of contents and "Add topic" tab would work as expected when transcluded, but new sections would still show up at the bottom of the page.

The workaround is to subst: the template into the lead of your article first:

{{subst:newsectiontop}}

References