Open kotoyama opened 1 year ago
Came up with this solution as a workaround.
// .eleventy.js
...
eleventyConfig.addPlugin(faviconsPlugin, {
generateManifest: false,
})
// _layouts/manifest.njk
{
"lang": "{{ lang }}",
"dir": "{{ dir or 'ltr' }}",
"short_name": "{{ meta[lang].title }}",
"name": "{{ meta[lang].title }}",
"description": "{{ meta[lang].description }}",
"orientation": "{{ 'any' }}",
"scope": "{{ '/' }}",
"start_url": "{{ '/' }}",
"theme_color": "{{ '#090d11' }}",
"background_color": "{{ '#090d11' }}",
"display": "{{ 'standalone' }}",
// copy from plugin once
"icons": [
{ "src": "/icon-192.png", "type": "image/png", "sizes": "192x192" },
{ "src": "/icon-512.png", "type": "image/png", "sizes": "512x512" }
]
}
// _layouts/base.njk
...
// needs eleventy i18n plugin for locale url filter
<link rel="manifest" href="{{ "/site.webmanifest" | locale_url }}"">
// make for each lang
// example: en/manifest.njk
---
permalink: /{{ lang }}/site.webmanifest
layout: manifest
eleventyExcludeFromCollections: true
---
Hi there! Thank you for this plugin :)
Is there a chance to add support for multiple manifests? I have this structure of my
_data/meta.js
:And with this structure, I don't see any way to provide metadata to
manifestData
object to generate multiple manifests and associate them with the corresponding templates. Much appreciated for any help!