lerni / silverstripe-webmanifest
为 Silverstripe 提供的 YML 和/或 SiteConfig 的 webmanifest
Requires
- silverstripe/framework: ^4.0 || ^5.0
- silverstripe/siteconfig: ^4.0 || ^5.0
Suggests
- jonom/silverstripe-text-target-length: Gives hints to match desired length for name & short_name
- tractorcow/silverstripe-colorpicker: Used for theme_color & background_color if available
This package is auto-updated.
Last update: 2024-09-28 21:18:24 UTC
README
此模块为 Silverstripe 提供了 site.webmanifest。值可以通过 YAML 或 CMS 中的 SiteConfig 进行配置。YAML 配置(静态)和 SiteConfig 的值(动态 CMS)可以组合。
安装
Composer 是安装 Silverstripe 模块的首选方式。
composer require lerni/silverstripe-webmanifest
要求
- silverstripe/framework ^4 || ^5
- silverstripe/siteconfig ^4 || ^5
建议
- jonom/silverstripe-text-target-length ^2
- tractorcow/silverstripe-colorpicker ^4
配置
您可以通过 yml-config 设置 manifest 的 json 中的内容。以 'SiteConfig' 作为值,属性可以在 CMS 中的 SiteConfig 中逐个编辑(需要 dev/build)。或者,它们可以设置为其他 SiteConfig 值,如 'SiteConfig.Title'。如果没有特别设置 lang
,将使用 i18n::get_locale()
。在默认配置(如下所示)中,name
设置为 SiteConfig.Title
的值,为 short_name
自动添加一个字段。还可以将其他 webmanifest 值作为字符串或数组添加。请参阅 W3C 的完整设置列表。如果存在 Page
(CMS 模块),则 manifest 将通过 header 标签(<link rel="manifest" href="/site.webmanifest">
)进行链接,并且如果它具有值,还将设置 theme-color(<link rel="manifest" href="/site.webmanifest">
)。
Kraftausdruck\Webmanifest\Webmanifest: tab: 'Root.Webmanifest' fields: name: 'SiteConfig.Title' # max. 30 characters short_name: 'SiteConfig' # max. 12 characters description: 'SiteConfig.Tagline' # max. 132 characters start_url: '/' background_color: '#ffffff' theme_color: '#ffffff' icons: - src: '/icon-192.png' sizes: '192x192' type: 'image/png' - src: '/icon-512.png' sizes: '512x512' type: 'image/png'