If a link to a page exists on the page itself, it currently is displayed as the page title in bold text. The SelfLinkBegin hook (gerrit I343e1b1b08ec841d22a1b22bcb8af43bb65a5a50) allows extensions to modify the text that is displayed. This new functionality is desirable in the SemanticTitle extension. The SemanticTitle extension enables the display semantic property on a page as a user-friendly page title instead of the actual page title. The use of the SelfLinkBegin hook can be seen in SemanticTitle in gerrit I593f263723498aa28ff945c4094f27d817c1ad27.
As an example of how you can test this feature, install Semantic MediaWiki and SemanticTitle and set
$wgSemanticTitleProperties = array( NS_MAIN => "Title" );
Create a property page named Property:Title containing "[[Has type::Text]]". Create a test page in the main namespace containing the text:
{{#set:Title=Semantic Title}} [[{{FULLPAGENAME}}]].
Currently, the page will display the title of the test page in bold. With the two patches above applied, the page will display the text "Semantic Title" in bold.
While this example is very simplistic, a more complex example where this is necessary is a page that includes a Semantic MediaWiki #ask query that has a link to the current page in the query results. Consider a page for an author that lists citations to all of the author's works as a result of a query. Each citation would include the list of authors, including co-authors, as links to their author pages. Using SemanticTitle, each author page can exist with a title of the form "Author:xxxxxx" in the Author namespace, where xxxxxx is a unique number, with the page title displayed as the author's name using a property on the page. However, in the citation list, the link to the author in question would be displayed as the bold text Author:xxxxxx, where xxxxxx is the unique number for the current author page, rather than the author's name.
Version: 1.23.0
Severity: enhancement