Extension:Display Title

The Display Title extension allows a page's display title to be used as the default link text in links to the page - both links from other pages as well as self-links on the page. Display Title also uses the display title of a page as part of the title of its talk page. It optionally displays the original page title as a subtitle on the page. And, it provides a parser function to query a page's display title.

This extension builds on functionality in MediaWiki core that supports setting a page's display title using the  magic word. Placing   on a page stores the value of the display title (My Display Title in this case) in the displaytitle page property of the MediaWiki page_props table and, if configured appropriately, displays that value on the page as the title in the title bar. The Display Title extension queries the displaytitle value in the page_props table to provide its features.

Configuration parameters
While not strictly necessary for the functioning of Display Title, in order to allow the  magic word to function as expected, set the following MediaWiki core configuration variables:

parser function
The  parser function gets the display title of the page provided. For example:

will show the displaytitle of page. To get the display title of the current page, use:

Lua/Scribunto support
Two Lua (see Extension:Scribunto) functions exist for getting and setting a page's display title:  and. To use them, you could create a page  containing the following:

local p = {}

function p.set(frame) return mw.ext.displaytitle.set(frame.args[1]) end

function p.get(frame) return mw.ext.displaytitle.get(frame.args[1]) end

return p

You could then use  on a page to set the page's display title to My Display Title, and you could use   to get the display title of page My Page.

History
The functionality in this extension evolved as part of the Semantic Title extension. Special thanks go to Van de Bugger, the author of version 1.0 of Semantic Title.

Display Title relies only on functionality in MediaWiki core; it does not depend on any other extension. The functionality in Display Title has been removed from Semantic Title, which now retains solely the functionality to set a page's display title from a Semantic MediaWiki property or Cargo field. However, it is recommended that a page's display title be set using  rather than the functionality in Semantic Title. Semantic Title is being maintained for backward compatibility.

Release notes

 * Version 1.5
 * Text that should have overridden link text was being ignored
 * Fix link to user page in header (personal URLs)
 * Version 1.4
 * Updated to work with MediaWiki 1.28+
 * Version 1.3
 * Modified self-links to determine display text identically to non-self-links
 * Version 1.2
 * Added mw.ext.displaytitle.get and mw.ext.displaytitle.get Lua functions written by User:Oetterer
 * Version 1.1
 * Added check for title with only fragment when creating link
 * Version 1.0
 * Initial release