gatsby-plugin-manifest: Get icon/favicon from CMS #32101
Unanswered
ojohnny
asked this question in
Ideas / Feature Requests
Replies: 1 comment
-
It's fairly straight forward to implement the ability at the plugin level. It's done in other plugins such as I could see implementing this in 1 of 2 ways. first, allow options to be a function. {
resolve: `gatsby-plugin-manifest`,
options: async ({ graphql }) => {
const results = await graphql(`
query {
...
}
`)
return {
icon: results.icon.path,
...
}
}
} alternatively: // gatsby-config.js
{
resolve: `gatsby-plugin-manifest`,
options: {
name: 'My App'
...
},
query: async ({ graphql }){`
const result = await graphql(`
query {
...
}`)
return {
icon: results.icon.path,
...
}
}
}
// elsewhere in Gatsby
const results = await query({ graphql })
const pluignOptions = deepMerge(options, results) Potential downsides
potential unintended features
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have recently encountered projects where it would make most sense to reuse the same Gatsby repository for multiple sites (under the same parent company, which is reason enough to keep structure/layout as similar as possible). The sites do have different logos etc, which for the most part is easy to implement as we can get that info via GraphQL from the CMS (in my case WordPress).
However, the icon/favicon for a Gatsby project is now specified via
gatsby-plugin-manifest
, which seems to take a path to a file inside the repository. It would be nice to be able to source this from the CMS. At least WordPress have a setting for this under Appearance → Customize → Site Identity → Site Icon.The only idea for a workaround I have in the meantime is to store all possible icons inside the repository and use an environment variable to select the one to use, but I think it would be good if a more flexible solution existed.
Ideas on how to solve this or other workarounds are welcome.
Beta Was this translation helpful? Give feedback.
All reactions