Extension:Title Icon
Title Icon Release status: stable |
|
---|---|
Implementation | User interface |
Description | Displays an icon to the left of the page title at the top of the page and in search results. Often used to help users easily recognize pages in a particular category |
Author(s) | Cindy Cicalese (cindy.cicalesetalk) |
Latest version | 4.1.1 (2020-03-06) |
Compatibility policy | Master maintains backwards compatibility. |
MediaWiki | 1.28+ |
PHP | 5.5+ |
Database changes | No |
License | MIT License |
Download | |
Example | sandbox.semantic-mediawiki.org |
|
|
Translate the Title Icon extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The Title Icon extension places an icon beside the page title when the title is displayed at the top of the page and when the page is listed in search results. Display of such an icon can help users easily visually detect that a page is in a particular category. This helps on the page itself, but also helps when trying to pick out the correct page from a list of search results.
The icon is specified by a semantic property of type Text that indicates the filename of an image file uploaded to the wiki. The extension looks for the property on the page itself and on the category page of any category to which the page belongs. Multiple icons will be displayed where multiple values are assigned to the property up to a maximum of five for each page queried for the property (the page itself and its categories). However, if the same icon is specified more than once, it will only be displayed once. The icon is sized to 36 pixels by 36 pixels maintaining its original aspect ratio.
By default, Title Icon will insert the icon in the title at the top of a page for any skin that puts the title in an HTML element with id firstHeading
such as the default Vector skin. This can be changed for other skins using the $wgTitleIcon_CSSSelector
configuration variable. This approach can also be used to have the Title Icon appear at other places in the page by using a <div>
and appropriate choice of $wgTitleIcon_CSSSelector
.
Special thanks to Bernadette Clemente for the original idea that inspired this extension and to Keven Ring for an early implementation of this extension.
Installation[edit]
- Download and place the file(s) in a directory called
TitleIcon
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'TitleIcon' );
- Create the page for the property defined in
$wgTitleIcon_TitleIconPropertyName
(default: 'Property:Title Icon') and ensure it[[Has type::Text]]
.Note: The extension will not work without this property-page!
- Configure as required.
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Configuration[edit]
Flag | Default | Description |
---|---|---|
$wgTitleIcon_EnableIconInPageTitle
|
true | Enables/disables the addition icons to the title bar of pages for this wiki. |
$wgTitleIcon_EnableIconInSearchTitle
|
true | Enables/disables the addition icons to the title of pages listed in search results for this wiki. |
$wgTitleIcon_CSSSelector
|
"#firstHeading" | Specifies the CSS selector that will be used to locate the page title. The Vector skin uses #firstHeading . The Foreground skin uses h2.title if it's the Foreground skin before December 2015. If it's after that date the CSSSelector is the same as the Vector skin.
|
$wgTitleIcon_UseFileNameAsToolTip
|
true | When set to true, uses the name of the image file without the file extension (i.e up to but not including the first "." and anything following it) as the tooltip when the mouse hovers over the icon. When set to false, the title of the page where the icon was set in the title icon property (either the page itself or one of its category pages) will be used instead. |
$wgTitleIcon_TitleIconPropertyName
|
"Title Icon" | The name of the property of type Text that is used to specify the title icon image file name. NOTE: This property must exist, and it must be of type Text. |
$wgTitleIcon_HideTitleIconPropertyName
|
"Hide Title Icon" | The name of a property of type Text that can be used to control the display of title icons for a given page.
|
NOTE: The $TitleIcon_UseDisplayTitle
and $TitleIcon_DisplayTitlePropertyName
parameters were removed in version 2.0 since they duplicate and conflict with functionality provided by the Semantic Title extension.
Release Notes[edit]
- Version 4.1.1
- Replace use of $wgParser with dependency injection facility
- Version 4.1
- Fixed to work with Semantic MediaWiki 3.0.0 (Undefined class constant 'TYPE_STRING')
- Version 4.0
- Fixes rendering in search results which breaks compatbility with MediaWiki 1.27 and lower
- Version 3.0
- Removed use of inline JavaScript that caused issues in MediaWiki 1.26
- Converted to new extension registration style
- Removed support for old style i18n and extension registration
- Renamed configuration variables with $wg prefix to support new extension registration format
- Version 2.2
- Added
$TitleIcon_CSSSelector
and updated coding style
Examples[edit]
Category:Title Icon Example:
{{#set:Title Icon=Event.png}} {{#set:Title Icon=FAQ.png}}
Title Icon Example 1:
{{#set:Title Icon=Report.png}} {{#set:Title Icon=FAQ.png}} [[Category:Title Icon Example]]
Title Icon Example 2:
{{#set:Hide Title Icon=all}} {{#set:Title Icon=Report.png}} {{#set:Title Icon=FAQ.png}} [[Category:Title Icon Example]]
Title Icon Example 3:
{{#set:Hide Title Icon=page}} {{#set:Title Icon=Report.png}} {{#set:Title Icon=FAQ.png}} [[Category:Title Icon Example]]
Title Icon Example 4:
{{#set:Hide Title Icon=category}} {{#set:Title Icon=Report.png}} {{#set:Title Icon=FAQ.png}} [[Category:Title Icon Example]]
Title Icon Example 5:
{{#set:Title Icon=Event.png}} {{DISPLAYTITLE:Events}}