ArticleComments Extension


Jump to: navigation, search

The ArticleComments Extension is a MediaWiki extension for adding inline comment forms to regular Wiki articles.

It is released under The MIT License.



This extension requires:

  • MediaWiki 1.6.x, 1.8.x, or 1.9.x
  • PHP 4.x or 5.x


  1. Download ArticleComments, and be sure to rename the downloaded file to ArticleComments.php.
  2. Drop this script in $IP/extensions
    Note: $IP is your MediaWiki install dir.
  3. Enable the extension by adding this line to your LocalSettings.php:


Once installed, you (or editors of your wiki) may add comment forms to any article.

To do so, simply add this text to the body of your page where you'd like the comment form to appear:

<comments />

Comment Placement

As of version 0.4.3, comments can now be injected mid-article rather than always appending at the end. To use this feature, simply insert the text "<!--COMMENTS_ABOVE-->" or "<!--COMMENTS_BELOW-->", which force ArticleComments to inject new comments before or after those markers respectively.

This means it is now possible to have comments listed reverse chronological order, newest at the top. To do so, just add "<!--COMMENTS_BELOW-->" at the top of the Talk page. For example, a talk page might start off with this:

<noinclude>Comments on [[{{PAGENAME}}]]
<comments />
----- __NOEDITSECTION__</noinclude>

An additional benefit of this new insertion feature is that ArticleComments can be used with WikiArticleFeeds to give RSS feeds of comments on a given article.

To do this, the Talk page should start out like this:

Comments on [[{{PAGENAME}}]]
<comments />
----- __NOEDITSECTION__<startFeed /><onlyinclude>
</onlyinclude><endFeed />
Note: Of course, if you want to retain the normal chronologically ordered list of comments, you'd use COMMENTS_ABOVE there instead of COMMENTS_BELOW.

To make the above the default in your wiki, log in with a user with Sysop privileges and edit the [[MediaWiki:Article-comments-talk-page-starter]] article to contain whatever starter text you like.


Answers to common configuration questions.

Removing the URL Field

There are two ways to remove the URL field from ArticleComments forms: globally and individually.

To globally remove all URL fields from all ArticleComments forms, add this to your LocalSettings.php file somewhere after the require() call:

$wgArticleCommentDefaults['showurlfield'] = false;

To remove the URL field from a particular ArticleComments form, simply specify the showurlfield attribute to be false like this:

<comments showurlfield='false' />

Note that even if you disable the URL field globally via the first method above, it can still be enabled on a per-form basis using the showurlfield attribute. For example, this would cancel the effect of the global setting for the form in question:

<comments showurlfield='true' />


If you'd like to post test comments, please use the ArticleComments Test Page.

Technical Details

In addition to providing a parser hook for the <comments> tag, the ArticleComments Extension implements a SpecialPage which acts as the recipient of the submitted comment.

Caveats and Gotchas

Known quirks in current behavior. These are not bugs per se, however they are probably good targets for future development.

Wikitext Filtering

Currently there is no filtering done on the incoming text - all Wikitext is accepted. This can lead to strange cases, as when a person adds an equal or higher level heading than the comment separator (defaults to '==').

One way around this is to change the 'article-comments-new-comment' message, which defaults to this:

== $1 ==

<div class='commentBlock'>

--$3 $4

The variables are as follows:

  • $1: Submitter said ...
  • $2: Comment content
  • $3: Username and link to Webpage (if provided)
  • $4: Date and time of submission

Notice that the content is wrapped in a div of class 'commentBlock'. This is to aid styling via CSS.

This provides a very weak opportunity for protection against embedded higher-level headings, since you could use a CSS rule to prevent internal <h#> tags from being displayed. For example:

.commentBlock h1, .commentBlock h2 {
  display: none;

You can modify the contents of this message by creating a page called "MediaWiki:article-comments-new-comment". When you create the page, it should be preloaded with the default contents.

One option (to disallow all wikitext) is to change the commentBlock div to a <nowiki> wrapper like this:

== $1 ==


--$3 $4

Known Issues

These are known functional or 'design' bugs that should be fixed as soon as possible.

Website URLs Lacking Protocols

Looking at the comments left on Talk:ArticleComments Test Page, it's clear that some users expect to be able to omit the protocol on their Website URL. For example using instead of

As of version 0.3, the URL field is prefilled with "http://" to help visitors in specifying a website. However, the extensions should probably check for the existence of an accepted protocol and prepend "http://" if absent. This may be implemented in a future version.

Fields accept arbitrary input

Although it makes sense for the comment field to accept arbitrary wikitext (under most circumstances), it does not make sense to allow arbitrary input in the other fields: Name and Website.

A future version should disallow arbitrary text by urlencoding the field values.


Leave a comment
Sorry, comments are disabled.

or, read what others have said ...