Closed toniengelhardt closed 1 year ago
@toniengelhardt Well if there's no automatic meta tags, if user does not set it dynamically in their code, it would miss many required tags for PWA. I'd vote for the possibility to opt-out each automatic meta tag, to prevent any duplicated tag and have full control.
I think we should be able to pass false
to any property under pwa.meta
.
It's already the case for many properties (one example is mobileApp
property), but for theme_color
, it fallback to pwa.manifest
value, and as of its TypeScript type, boolean
is not accepted.
Here are the current types for each property : https://github.com/kevinmarrec/nuxt-pwa-module/blob/bdd4b4fbb4c78d804e36847b9510a535d393a4c0/src/parts/meta/types.ts#L1-L21
I should enhance them to make them all able to be either boolean | {currentType}
or just false | {currentType}
.
Sounds good!
The default for
theme_color
in the manifest is set to#000000
. This gets somehow injected as a duplicatetheme-color
meta tag in the header and overrides the normaltheme-color
frommeta
. You can see this, when adding this innuxt.config.ts
:and opening the app in Chrome mobile. The theme will be black.
Here's the HTML output:
A note on setting meta tags automatically from manifest... I think that is not a good idea at all, or at least they should not override existing meta tags because the meta tags can be controlled dynamically in the code whereas manifest can not.
In my app for instance, I want to set the
theme-color
dynamically from the theme the app uses, which works perfectly if they are set and updated as meta tags in Nuxt 2.Demo: https://pwa.journalisticapp.com