Manual:$wgLogo

From Linux Web Expert

Revision as of 00:18, 16 July 2023 by imported>Shirayuki (typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

File:OOjs UI icon alert-destructive.svg <translate> Caution:</translate> MediaWiki installations after MediaWiki 1.35.0 should be using $wgLogos as $wgLogo is no longer supported.[1]
<translate> Server URLs and file paths</translate>: $wgLogo
The URL of the site logo.
<translate> Introduced in version:</translate>pre 1.1.0
<translate> Removed in version:</translate><translate> still in use</translate>
<translate> Allowed values:</translate>(relative path or absolute URL)
<translate> Default value:</translate>"{$wgScriptPath }/resources/assets/change-your-logo.svg" (1.38+)

"{$wgScriptPath }/resources/assets/wiki.png" (1.24-1.37)
"{$wgStylePath }/common/images/wiki.png" (pre 1.1.0 – 1.23)

(<translate> Note:</translate> <translate> The default value of this variable depends on other variables, such as the values set in <tvar|1>Setup.php </>, after <tvar|2>LocalSettings.php </> is executed</translate>)

Details

File:MediaWiki-2020-logo.svg
The MediaWiki.org site logo. Your logo should be the same size, i.e. 135 pixels.

The URL of the site logo (i.e. the image displayed in the upper-left corner of the page in most MediaWiki installations). Either a fully-qualified URL or a relative path from DOCUMENT_ROOT. If it's a relative path, it has to start with a slash (a file in DOCUMENT_ROOT is /file.png, not file.png).

The logo is expected to be 135 × 135 pixels. A bigger size can be used by modifying the site CSS (and smaller sizes are possible with no changes). Note that if you use a bigger image, MediaWiki will not resize this image! Instead, the image will be cut off so that only part of it (the upper left-hand corner to be precise) will be visible. If this corner is completely white, it might look like the image does not display although in fact it does.

File:OOjs UI icon alert-destructive.svg <translate> Caution:</translate> Do not simply overwrite the default logo installed with MediaWiki (/resources/assets/change-your-logo.svg); this file will automatically be overwritten when you upgrade and your changes will be lost.

Examples

Upload your logo file onto your server. Let's say it ends up as /images/4/47/mylogo.png. Then you can use it as your site logo by adding this line to LocalSettings.php:

$wgLogo = $wgScriptPath . '/images/4/47/mylogo.png';

Make sure that you add this line below the definition of $wgScriptPath! Otherwise, $wgScriptPath will still be undefined and the logo will not display.

Vary logo per language

With CSS, it is possible to use a different logo for each interface language:

.mw-wiki-logo:lang(ar) {
	background-image: url( /logos/ar.png ) !important;
}

.mw-wiki-logo:lang(de) {
	background-image: url( /logos/de.png ) !important;
}

See also