Page Titles

From mw.mh370.wiki
Jump to navigation Jump to search


A Guide to Using MediaWiki in a Hosted Environment

An instructional website by the developer of mh370wiki.net - a MediaWiki site about Malaysia Airlines Flight MH370.


On the mh370wiki.net I have used short names for pages but would prefer the reader to see something more descriptive. Two examples:-

  1. Many countries assisted with the search for MH370, the investigations, or debris was located. The website has one page-per-country with the country name as the page title. While the page title is short, for example Australia, the first heading is more descriptive, for example Australia and Malaysia Airlines Flight MH370. That would be nice as a displayed page title.
  2. All of the media statements related to flight MH370 are in News pages and the title includes a Day Number, for example 2014/Day 001 which is the day of the incident, Saturday 8 March 2014. The date is more useful to a reader; the Day# is more useful for indexing content within the site.


Magic Word DISPLAYTITLE

MediaWiki does permit the displayed page title to be different from the actual page title - with restrictions.

The intention is to allow a variant of the page title to be displayed if it is more correct, for example if I attempted to create a page titled wgRestrictDisplayTitle, MediaWiki would capitalise the first letter Create the page "WgRestrictPageTitle" on this wiki!. If WgRestrictPageTitle was the actual page name, the magic word DISPLAYTITLE could be used on the page like this: {{DISPLAYTITLE:wgRestrictDisplayTitle}} and the reader would see the first letter in lower case.

It is NOT the intention of MediaWiki developers to enable this magic word to display something completely different from the actual page title. But it can be done, and would be useful.

For DISPLAYTITLE to work, two settings must be configured. But it may not work. A solution is below.


$wgAllowDisplayTitle

The default is $wgAllowDisplayTitle = 'true';. This setting allows the magic word DISPLAYTITLE to make minor changes to a page title such as changing letter case.

For example, {{DISPLAYTITLE:australia}} displayed the title of the Australia page as australia. But did not allow a different title such as Australia and Malaysia Airlines Flight MH370.

This is because $wgRestrictDisplayTitle is true by default.


$wgRestrictDisplayTitle

The default is $wgRestrictDisplayTitle = 'true';. This restricts the usage of the magic word DISPLAYTITLE.

Changing the setting is simple - place the setting $wgRestrictDisplayTitle = 'false'; in LocalSettings.php.

If you want to be sure, put both settings in LocalSettings.php:-

# Allow full use of DisplayTitle
$wgAllowDisplayTitle = 'true'; 
$wgRestrictDisplayTitle = 'false';

This should work, except when it doesn't.


When DISPLAYTITLE Doesn't Work

Configuration in LocalSettings.php is supposed to over-ride MediaWiki default configuration. However, a new value for $wgRestrictDisplayTitle in LocalSettings.php may not over-ride the MediaWiki default.

The default value for each variable $wgAllowDisplayTitle and $wgRestrictDisplayTitle is configured in the file /w/includes/config-schema.php (In MediaWiki version 1.43.).

Default values for Display Title variables

Configuration Tests

For each combination of settings I have two tests. On the current version of mh370wiki.net and the page Australia I will use the magic word DISPLAYTITLE to (separately) display two variants of the current page title (Australia):-

  1. {{DISPLAYTITLE:australia}} If this title displays correctly then the effective value of $wgAllowDisplayTitle must be true.
  2. {{DISPLAYTITLE:Australia and Malaysia Airlines Flight MH370}} If this title displays correctly then the effective value of $wgRestrictDisplayTitle must be false.


Test config-schema.php LocalSettings.php Displayed Title
1 Default Configuration
'AllowDisplayTitle' => true,
'RestrictDisplayTitle' => true,

No Settings

  1. australia
  2. Australia
2
'AllowDisplayTitle' => true,
'RestrictDisplayTitle' => true,
   
#$wgAllowDisplayTitle = 'true';
$wgRestrictDisplayTitle = 'false';
   
  1. australia
  2. Australia
3
'AllowDisplayTitle' => false,
'RestrictDisplayTitle' => true,
   
$wgAllowDisplayTitle = 'true';
$wgRestrictDisplayTitle = 'false';
   
  1. australia
  2. Australia
4
'AllowDisplayTitle' => false,
'RestrictDisplayTitle' => false,
   
$wgAllowDisplayTitle = 'true';
$wgRestrictDisplayTitle = 'false';
   
  1. australia
  2. Australia
5
'AllowDisplayTitle' => true,
'RestrictDisplayTitle' => false,
$wgAllowDisplayTitle = 'true';
$wgRestrictDisplayTitle = 'false';
   
  1. australia
  2. Australia
    6
    'AllowDisplayTitle' => true,
    'RestrictDisplayTitle' => false,
       

    No Settings

    1. australia
    2. Australia and Malaysia Airlines Flight MH370

    Results

    1. MediaWiki default settings in config-schema.php are applied as intended. A radically different title is not displayed.

    2. Setting $wgRestrictDisplayTitle to false in LocalSettings.php does not over-ride the default setting of false in config-schema.php

    3. Setting $wgAllowDisplayTitle to true in LocalSettings.php does over-ride a setting of false in config-schema.php
      Setting $wgRestrictDisplayTitle to false in LocalSettings.php does not over-ride the default setting of false in config-schema.php

    4. Setting $wgAllowDisplayTitle to true in LocalSettings.php does over-ride a setting of false in config-schema.php
      However, although $wgRestrictDisplayTitle is false in config-schema.php and in LocalSettings.php the setting has no effect - the longer title is not displayed as it should.

    5. $wgAllowDisplayTitle is true in config-schema.php and also in LocalSettings.php and is applied as intended.
      $wgRestrictDisplayTitle is false in config-schema.php and is also false in LocalSettings.php. However, as in Test 4 the alternate (longer) page title is not displayed.
      Even when the configuration is the same in both locations the configuration of $wgRestrictDisplayTitle = false is not applied. This does not make sense.
      I have triple-checked this result and have no explanation for this outcome.

    6. When there is no configuration in LocalSettings.php (similar to Test 1) the settings in config-schema.php are applied, and the outcome is correct.


    Solution

    There is no 'solution', only a 'work-around'.

    I have edited /w/includes/config-schema.php as below. This is not good practice. When upgrading MediaWiki version this change may need to be done to the new source code. The comments will help to find the settings.

    # default is 'AllowDisplayTitle' => true,			
    			'AllowDisplayTitle' => true,
    # default is 'RestrictDisplayTitle' => true,			
    			'RestrictDisplayTitle' => false,
    

    And in LocalSettings.php I added the following:-

    # 6 August 2025 Allow DisplayTitle
    # $wgAllowDisplayTitle = 'true'; is true by default
    # $wgRestrictDisplayTitle = 'false'; is configured in
    # /w/includes/config-schema.php and does not apply if configured here
    

    Application

    On the mh370wiki.net website the change to each country page will be quite simple. The next version release will use this feature.

    The News pages will benefit too, and the application is more interesting because it will involve templates.


    How to find a specific configuration in MediaWiki

    Before writing this article I was not familiar with the file /w/includes/config-schema.php. I had to search for the configuration for $wgRestrictDisplayTitle.

    See the article on LocalSettings.php and comment about MainConfigSchema.php.


    Links

    Manual:Page title
    https://www.mediawiki.org/wiki/Manual:Page_title
    Display title
    https://www.mediawiki.org/wiki/Display_title
    Help:Magic words #DISPLAYTITLE
    https://www.mediawiki.org/wiki/Help:Magic_words#DISPLAYTITLE
    Manual:$wgAllowDisplayTitle
    https://www.mediawiki.org/wiki/Manual:$wgAllowDisplayTitle
    Manual:$wgRestrictDisplayTitle
    https://www.mediawiki.org/wiki/Manual:$wgRestrictDisplayTitle