[Mediawiki-l] modify page title when displaying an article

Platonides Platonides at gmail.com
Mon Oct 4 23:02:58 UTC 2010

Laurent Savaete wrote:
> Hello,
> I am trying to change the way the title of pages in a specific
> namespace are displayed.
> All pages in this namespace (Lesson:) contain a <wikibabel> tag, which
> I've registered with the parser using  $wgParser->setHook(
> 'wikibabel', 'efWikiBabelRender' );
> I'm also using the ParserAfterTidy hook to prevent mediawiki amending
> my extension's html output, as was explained in the mediawiki manual.
> It all works fine, but I would like to modify the way the page title
> (both <title> and <h1>) is shown, just to make it look a bit more
> sexy. I've tried using $wgOut->setPageTitle(), but somehow it gets
> overwritten by subsequent calls from somewhere else in the page
> displaying process.
> If I call setPageTitle from the BeforePageDisplay hook, I get the <h1>
> to display what I want, but <title> does not seem to hear me.
> setHTMLTitle does nothing either.
> Any ideas how I could do that? Just to be extra clear, I'm not trying
> to change the actual page title, only how it's displayed. (ideally, if
> there's some method to do it throughout the wiki, it would be great).
> The reason why I'm doing all this is to try and make the title easily
> parsable. If that's stupid, and you can think of a better way to do
> it, I'm open to suggestions :)
> An example page would be:
> http://www.wiki-babel.org/en/Lesson:Fra:1:The_survival_kit
> cheers,
> Laurent

No need for a custom tag. You can use {{DISPLAYTITLE: }}
You need $wgRestrictDisplayTitle to be able to set any title.
See http://www.mediawiki.org/wiki/Manual:$wgAllowDisplayTitle

More information about the MediaWiki-l mailing list