手册:$wgAppleTouchIcon
服务器URL及文件路徑: $wgAppleTouchIcon | |
---|---|
当 Apple 手持设备将 wiki 收藏到主屏幕时可选的指向一个图标的 URL |
|
引进版本: | 1.12.0 (r29942) |
移除版本: | 仍在使用 |
允许的值: | (相对路径或绝对路径URL) |
默认值: | false |
其他设置: 按首字母排序 | 按功能排序 |
详情
当你从 Safari 保存一个书签到主屏幕时,Apple 的 iPhone,iPod Touch 以及 iPad 设备能够显示一个图标。 这类似于 Favicon,但尺寸更大(57x57,72x72 及 114x114 像素,取决于设备)。
Safari Web 内容教程推荐在你的网站上的文档根目录文件夹放一个叫“apple-touch-icon.png”的文件;使用“apple-touch-icon-precomposed.png”来避免 iOS 为你的图标添加的圆角和闪亮效果。 但是,有时候你可能需要一个自定义图标,那么你可以使用这个格式:
$wgAppleTouchIcon = "/wiki/icons/apple-touch-icon.png";
这会在 HTML 头输出里添加一个 <link> 标签:
<link rel="apple-touch-icon" href="/wiki/icons/apple-touch-icon.png" />
因为$wgAppleTouchIcon 默认被设为 false,MediaWiki 不会生成链接,然后浏览器会尝试加载“/apple-touch-icon.png”。 如果这也没有,浏览器会使用页面的缩略图做图标,这样完全不吸引人。
Using the override option, wikis may set a different icon from other pages on the same host, or may simply choose to set a custom URL.
For Android devices place "apple-touch-icon-precomposed.png" in your root directory, and include $wgAppleTouchIcon = "$wgScriptPath/apple-touch-icon-precomposed.png";
in LocalSettings.php.
指引
Clean images with good sharpness and contrast and a bright colored background will fit in reasonably well with other icons. If you don't have one to test with, refer to handy screen shots such as the one here.
Apple documentation recommends a 114×114 pixel PNG image; however, 118×120 seems to be the mark for retina displays. A smaller image is scaled up slightly, becoming a bit blurry. Wikimedia projects currently (May 2021) use 152×152 pixel.
Rounded corners and a "glossy" texture are added by the iPhone UI, so use a flat, square background in your source image:
原始图片: | As rendered: |
---|---|
Transparent backgrounds are rendered as solid black.