Embedding MediaWiki Disqus widget inside page footer template
Problem
I'd like to show the MediaWiki Disqus widget at the bottom of each page. And I don't want to edit each page manually.
Solution
Embed the Disqus widget inside templates and use the ReplaceText extension to add a template to the bottom of each page.
Following the steps underneath, each MediaWiki article will now render this:
+----------------+ +---------------------+ +--------------------+ +---------------+
| Article | ,-->| Template:PageFooter | ,-->| Template:Disqus | ,-->| Widget:DISQUS |
+----------------+ / +---------------------+ / +--------------------+ / +---------------+
| ... | / | ... | / | ... | / | ... |
| {{PageFooter}} +--' | ==Comments== | / | {{#widget:DISQUS}} +--' +---------------+
+----------------+ | {{Disqus}} +--' +--------------------+
+---------------------+
Steps
#1. Embed DISQUS widget within Disqus template
#2. Embed Disqus template within PageFooter template
#3. Add PageFooter template to each page
#4. (optional) Conditional embedding of Disqus template
1. Embed DISQUS widget within Disqus template
Create a MediaWiki Template:Disqus in which to embed the {{#widget:DISQUS}} widget (replace "yourid"):
<noinclude>This template adds the [http://www.mediawikiwidgets.org/DISQUS DISQUS widget] to an article page.
</noinclude><includeonly>==Comments==
{{#widget:DISQUS
|id=yourid
|uniqid={{PAGENAME}}
|url={{fullurl:{{PAGENAME}}}}
}}</includeonly>2. Embed Disqus template within PageFooter template
Create a MediaWiki Template:PageFooter in which to embed the Disqus template:
<noinclude>Header at the bottom of each page
</noinclude><includeonly>{{Disqus}}</includeonly>3. Add PageFooter template to each page

Install the ReplaceText extension, go to page Special:ReplaceText and insert the PageFooter template at the end of each page, using these settings:
| field | value | comment |
|---|---|---|
| Original text: | $ | Denotes the end of the text (regular expression syntax) |
| Replacement text: | ↵ ↵ {{PageFooter}} | Make sure the replacement text starts with two empty lines. This will insert the {{PageFooter}} template on a separate line, making the template insensitive for MediaWiki nested formatting bugs (e.g. :text==header==) |
| Use regular expressions | yes |
4. (optional) Conditional embedding of Disqus template
Install the ParserFunctions extension, and modify Template:PageFooter like this:
<noinclude>Header at the bottom of each page
</noinclude><includeonly>{{#switch: {{FULLPAGENAME}}
| Main Page =
| #default = ==Comments==
{{Disqus}}
}}
</includeonly>This will make the Disqus template show on every page, except the Main Page.