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

Laurent Savaete laurent.savaete at googlemail.com
Thu Oct 7 13:38:19 UTC 2010


Thanks Platonides, the {{DISPLAYTITLE:}} trick works fairly well (to
avoid having to modify and hardcode the title in the page, I used
$wgOut->addWikiText), except that somehow the HTML title is set before
the call to my tag renderer (which I need for other purposes).
Subsequent calls to setHTMLTitle don't seem to have any effect. Is
this the expected behaviour?

thanks again for your help,
Laurent

2010/10/5 Platonides <Platonides at gmail.com>:
> 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
> http://www.mediawiki.org/wiki/Manual:$wgRestrictDisplayTitle
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>



-- 
Follow me around the world: www.laurentaroundtheworld.net
Learn languages for free: www.wiki-babel.org



More information about the MediaWiki-l mailing list