Output the page's DISPLAYTITLE as a magic word. I suggest using {{PAGETITLE}}
It's possible to set the page title with {{DISPLAYTITLE}} to be a modified form of the page title. Or, with less paranoid wikis with $wgRestrictDisplayTitle=false; this could be any permitted string (there are still some restrictions).
So, for example, using {{PAGETITLE}} on the English Wikipedia page https://en.wikipedia.org/wiki/A_Day_in_the_Life_of_Lakshmi_Manchu%27s_Feet would output <i>A Day in the Life of Lakshmi Manchu's Feet</i> because that has a {{DISPLAYTITLE}} code to make it italic.
The code {{PAGETITLE:A_Day_in_the_Life_of_Lakshmi_Manchu's_Feet}} would output the same.
However, if the page has no {{DISPLAYTITLE}}, it should default back to the default, i.e. {{FULLPAGENAME}}.
Benefits:
This may have some uses with footnotes, system messages, being able to call it.
Notes:
- First, {{PAGETITLE}} needs to be defined in includes/parser/CoreMagicVariables.php add pagetitle (lowercase) to array $noHashFunctions = [].
- Next, the function needs to be defined in includes/parser/CoreParserFunctions.php.
- The page title can be pulled with getDisplayTitle() which would look something like (needs checking):
public static function pagetitle( $parser, $title = null ) {
$t = self::makeTitle( $parser, $title );
if ( $t === null ) {
return '';
}
return wfEscapeWikiText( $t->getDisplayTitle() );
}References