catalyst
catalyst copied to clipboard
Add dynamic favicon from API
What/Why?
Uses new favicon node in GraphQL Storefront API to return the store's favicon dynamically. The API will always return something; if there's no favicon, it defaults to the BC logo.
I made this a static route because favicons change so infrequently, but this does mean you need to rebuild the app to see an updated favicon.
Rather than returning a <link>
to our CDN, I'm proxying the image data and serving it directly; this is faster.
Putting do not merge
on this until the new GraphQL node is fully rolled out.
Note: I tried to follow the pattern here and do this in an icon.ts
file, but it didn't work for some reason.
Testing
Preview deployment: