-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-plugin-manifest] Favicon not updated on navigating to child app #17434
Comments
I've been working on fixing this and have a solution for the SSR case (when the page is initially loaded), but I'm having trouble updating the icons when the user navigates to a child app. My current approach:
For example, using the manifest shown in my initial post, if a user navigates from Where I got stuck:
My question:How would I go about figuring out filenames that include digests from the client? Is there some way to save a mapping from a child app to the names of its icons during the bootstrap or build stage in either |
@moonmeister @wardpeet I'd appreciate any pointers you might have so I can contribute back to |
@dkthehuman Those file names are correctly stored in the manifest, which is json...you could parse that. This seems like a couple different issues though. Currently localization only applies to the web app manifest. Maybe just fix that in this PR. If you want to try and extend the localization to affect the iOS icons and favicon, then I'd recommend a different PR to add that functionality and the related Also, I'm not too familiar with how Gatsby handles data but I'm pretty sure it ships per page JSON objects with data used at build time. @wardpeet Is there a way to add data to that so we can reference which icon should be used on any given page? |
Hadn't thought of that, thanks! Still, I'm hoping that there's some way to solve this without fetching the manifest and parsing it. :) |
This comment has been minimized.
This comment has been minimized.
@dkthehuman Was this fixed by #17426 or is that a different issue? If not can you clarify how this issue is different? |
@moonmeister Nope, that was a different issue. This issue has to do with the favicons not updating when navigating to a part of the app under a different manifest (what I'm calling a "child app"). With #17426, the manifest is now updated but the favicon is not. |
With the merging of #23077 this might be easier to resolve now that we completely control the favicon and its naming. |
why is it so difficult to add something simple like a favicon in gatsbyjs? |
It's not. No one has needed to scale favicons to be unique across languages and locales; thus, no one has taken the time to solve this problem. If this is your trouble, then we welcome you to help solve this problem with constructive conversation, thoughtful ideas, and good code. |
I ran into the same problem and I solved it on the server side by creating the digest based on the In the browser I ended up with the same problem as @dkthehuman, namely that the digest is missing from the information that is available in the runtime. Or more precisely only the Main app digest is there, but it's missing for all the localized pages. Here I am talking about an object that is referenced in the code as The idea I came up with is the following: we could also calculate the digest for all localized objects where there is an icon and store it as a Then in the browser the What do you think? |
Hey @agazso, I wasn't able to figure out a way to support cache busting so I ended up building a custom plugin to handle this use case without cache busting support: https://github.com/dkthehuman/gatsby-plugin-manifest-multiple I got a bit carried away and ended up refactoring all of |
@dkthehuman Nice! I will take a look at your plugin because it seems that it supports my use-case (having sub-sites with different icon instead of localized pages) better and the code also looks cleaner at first glance. Maybe combined that with my approach for cache busting we can have the best of both. |
Since this issue didn't gain a lot of traction / a lot of people requested this I'll defer to the community plugin if you need this functionality. Thanks for creating it! |
@LekoArts this was a bug not a feature. |
Description
First, some notes on terminology:
localize
option.When a child app in
localize
is loaded, the icon in the child manifest is not used for the favicon or apple-touch-icon links.Conditions
The plugin options for
gatsby-plugin-manifest
include a child app via thelocalize
array and it specifies a different icon.Steps to reproduce
Demo repo: https://github.com/dkthehuman/gatsby-manifest-l10n-bug-demo
Netlify: https://affectionate-franklin-dc4bfb.netlify.com
gatsby build && gatsby serve
on the test repo)apple-touch-icon
links point togatsby-icon.png
(the purple Gatsby icon) as expectedgatsby-icon-es.png
(a red dot) as it shouldThe text was updated successfully, but these errors were encountered: