手册:$wgLogos
服务器URL及文件路徑: $wgLogos | |
---|---|
设置您wiki的标志及其URL路径 |
|
引进版本: | 1.35.0 (Gerrit change 562588; git #8cd2e133) |
移除版本: | 仍在使用 |
允许的值: | (一些参数,以及相关的本地路径或URL) |
默认值: | false (注: 此变量的默认值取决于其他变量,例如执行LocalSettings.php 后在Setup.php 中设置的值) |
其他设置: 按首字母排序 | 按功能排序 |
详情
小心: | 不要直接覆盖安装MediaWiki时自带的那个默认标志 (/resources/assets/wiki.png ); 因为当您升级MediaWiki软件时它会被自动覆盖掉。 |
本配置设置提供了一连串的参数,还可以设置与它们相关的、指向不同版本wiki标志的本地或URL路径。 (就是那个在大多数MediaWiki页面的左上方显示的那个图标)
支持的类型
- “图标(icon)”
- 这张图像应该是个正方形。名义上来说,为了支持高分辨率(HiDPI),SVG版本的图像应该是50 × 50像素,光栅版本的则应该是100 × 100像素。 不过我们更推荐使用SVG版本。 目前,Skin:Vector , Skin:Timeless , Skin:清新 , Skin:公民 都支持这个类型,但我们建议所有新皮肤都使用它。 Note that other skins typically require a larger icon if they support this, so using an SVG instead is recommended as it will scale correctly across all of them.
- The 1× version
- it should be 135px wide by up to ~155px tall. This is because the 1.5× and 2× versions assume a nominal width of 135px, and up to 155px tall will fit without issues in standard skins. This supports older skins and in the long-term future will be deprecated. We recommend skins support the preferred `icon`.
- The 1.5× version
- it should 202px wide, matching the aspect ratio of the 1×. (so up to 232px tall, for 155px nominal height.) The key will be deprecated in future and its use is not recommended.
- The 2× version
- it should be 270px wide, matching the aspect ratio of the 1×. (so up to 310px tall, for 155px nominal height.) The key will be deprecated in future and its use is not recommended.
- The svg version
- it replaces the need for a 1x, 1.5x, and 2x version, but should follow the same nominal size guidelines, fitting within 135px wide and 155px tall when resized to 135px wide. The key will be deprecated in future and its use is not recommended.
There are also two optional fields for additional assets to show next to the logo:
- wordmark
- it should be a landscape logo, with maximum set width or height, as these are specified under the
width
andheight
keys. The width shouldn't exceed 124 and the height shouldn't exceed 32px. Typically this is the graphic version of $wgSitename. This is used in Skin:Vector (1.36), Skin:Timeless , Skin:Minerva , Skin:公民
- tagline
- the same is true for the tagline, which typically corresponds to the non-sitename part of MediaWiki:Tagline. The combined height of the tagline and wordmark should not exceed 50px.
All values (except width
and height
) can either be 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).
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 would not display, although in fact it does.
Example images
示例
$wgLogos = [
'1x' => "path/to/1x_version.png", // path to 1x version
'1.5x' => "path/to/1.5x_version.png", // path to 1.5x version
'2x' => "path/to/2x_version.png", // path to 2x version
'svg' => "path/to/svg_version.svg", // path to svg version
'icon' => "path/to/icon.png", // A version of the logo without wordmark and tagline
'wordmark' => [
'src' => "path/to/wordmark_version.png", // path to wordmark version
'1x' => "path/to/wordmark_version.svg", // optional if you want to support browsers with SVG support with an SVG logo.
'width' => 135,
'height' => 20,
],
'tagline' => [
'src' => "path/to/tagline_version.png", // path to tagline version
'width' => 135,
'height' => 15,
],
];
Simple example
$wgLogos = [
'icon' => "$wgScriptPath/lol.png", // path to icon, the primary logo for Vector
'1x' => "$wgScriptPath/myCustomLogo.png", // path to 1x version
'2x' => "$wgResourceBasePath/hiResLogo.png", // path to 2x version
];
Example paths
$wgLogos = [
'1x' => "/lol.png", // relative path to file in logo folder, 1x version
'1.5x' => "https://mywiki.org/w/resources/assets/lol.png", // fully qualified URL path to 1.5x version
'2x' => "/lol.png", // relative path to 2x version, which always starts with a slash
// 'svg' => "", // no svg (deprecated by MW)
'icon' => "lol.png", // Limited support, either 50x50 svg or 100x100 png
'wordmark' => [
'src' => "/wordmark_sitename.png", // 135px wide image of sitename text, limited support
'width' => 135,
'height' => 20,
],
'tagline' => [
'src' => "/tagline_subtitle.png", // 135px image to tagline text without sitename
'width' => 135,
'height' => 15,
],
];
添加標誌語言變體
The functionality to override logos for different language variants was introduced in version 1.36.0 (Gerrit change 627939, git #8cd2e133). 参见T261153。
When defining variants, any language key can be used, for example it is possible to provide a German variant of an English logo.
This was extended to apply to all logo keys in 1.39.0.
$wgLogos = [
'1x' => "path/to/1x_version.png", // 1x版本路徑
'1.5x' => "path/to/1.5x_version.png", // 1.5x版本路徑
'2x' => "path/to/2x_version.png", // 2x版本路徑
'svg' => "path/to/svg_version.svg", // svg版本路徑
'icon' => "path/to/icon.png", // A version of the logo without wordmark and tagline
'wordmark' => [
'src' => "path/to/wordmark_version.png", // path to wordmark version
'1x' => "path/to/wordmark_version.svg", // optional if you want to support browsers with SVG support with an SVG logo.
'width' => 135,
'height' => 20,
],
'tagline' => [
'src' => "path/to/tagline_version.png", // path to tagline version
'width' => 135,
'height' => 15,
],
'variants' => [
'variant-code' => [
'1x' => "path/to/language_variant_1x_version.png", // path to 1x version in language variant
'1.5x' => "path/to/language_variant_1.5x_version.png", // path to 1.5x version in language variant
'2x' => "path/to/language_variant_2x_version.png", // path to 2x version in language variant
'svg' => "path/to/language_variant_svg_version.svg", // path to svg version in language variant
'icon' => "path/to/language_variant_icon.png", // A version of the logo without wordmark and tagline in language variant
'wordmark' => [
'src' => "path/to/language_variant_wordmark_version.png", // path to wordmark version in language variant
'1x' => "path/to/language_variant_wordmark_version.svg", // optional if you want to support browsers with SVG support with an SVG logo in language variant.
'width' => 135,
'height' => 20,
],
],
],
];
Depending on your server settings, the information on which image to use may be cached inside a server cache. Also, images may be cached inside the web browser for a long time so that you do not immediately see the new logo, if you changed the according image file. In this case it might be necessary to especially empty caches and to reload the image URL in your web browser so that the browser downloads the current version from the server. |
参见
- 我如何更改标志?
- $wgLogo (MediaWiki < 1.35.0)
- $wgLogoHD (MediaWiki < 1.35.0)
- $wgFavicon
- $wgAppleTouchIcon