-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
How to change favicon? #6155
Comments
Here's my setup. First in
Then in
Then in
Hope that helps! |
My bad, I meant |
Solution I figured out to replace the default
I believe it works because it's copying the static directory files to the site root which overwrites the favicon.ico, but it could be some other dark magic I tried the manager-head.html solution but it was outputting the html into the body instead of the head. Not sure it that's a bug in v6.4.19 or if that's expected |
@shilman approach didn't help in my case nor @seantomlins's approach (for some reason) I ended up doing this hack in // manager.js
import favicon from './assets/favicon.ico';
const link = document.createElement('link');
link.setAttribute('rel', 'shortcut icon');
link.setAttribute('href', favicon);
document.head.appendChild(link); |
# Pull Request ## 🤨 Rationale The favicon in the Storybook site was non existent. Updating it to the Nimble icon. Used this information to help direct me to updating it: [How to change favicon? (Storybook GitHub)](storybookjs/storybook#6155) [Reference example from the MS Fluent Storybook Repo](https://github.com/microsoft/fluentui/blob/4c970883a796505b132b356aa03302c068eb0ea9/packages/web-components/.storybook/manager-head.html) I think this replaces this closed pull request: #217 ## 👩💻 Implementation - Added ICO and PNG versions of the Nimble Icon - Created an HTML file to reference them as the favicon - Updated the npm command 'storybook' to add the image files directory ## 🧪 Testing Ran storybook locally to make sure it displays the favicon correctly. <img width="871" alt="image" src="https://user-images.githubusercontent.com/109235103/187926080-0cedfec7-ea43-4453-a316-69f36ba0ddbf.png"> <img width="481" alt="image" src="https://user-images.githubusercontent.com/109235103/187926268-c222d54b-1eb6-420c-8d09-b249e8b5f368.png"> ## ✅ Checklist - [x ] I have updated the project documentation to reflect my changes or determined no changes are needed.
Thanks @sag1v , this was the only solution that worked for me. |
I'm using Storybook v7 and @seantomlins solution works fine! |
Just rename the file that you want to show as favicon to |
I second with @soumitya0 solution, this works for version |
I struggled to achieve this. I manage to do it by :
|
The solutions listed here did not work for me, in part because even when you add Plan B has been for me to rename it So what I ended up doing was to undo everything I did and to simply execute
|
Hello, |
+1 Same issue. So anybody knows how to change storybook favicon in v8? |
The only thing that you need to do in v8 is to add this in the config of main.js: |
Dear Christina,
But seems the favicon is more hardcoded than what I presumed!
|
So basically if you have 2 link tags with the rel="icon" it is like css so the last one is used. I didn't find a way to remove the prior favicon but for me it worked that way. I attach here the relevant info from mdn: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel#:~:text=If%20there%20are%20multiple%20%3Clink%20rel%3D%22icon%22%3Es%2C%20the%20browser%20uses%20their%20media%2C%20type%2C%20and%20sizes%20attributes%20to%20select%20the%20most%20appropriate%20icon.%20If%20several%20icons%20are%20equally%20appropriate%2C%20the%20last%20one%20is%20used. |
I am not sure, but probably it was a browser cache. The previous time I ran the project it was not loading the 2nd favicon. Thanks for correcting me. |
This is still an issue. Should have an easy way to change the favicon. |
Describe the bug
We are unable to set a custom favicon for the storybook static build and development. We've tried using HtmlWebpackPlugin, setting the icon with different urls in the
preview-header.html
andmanager-header.html
having imported the 'favicon.ico' in theconfig.js
as follows:And the
preview-header.html
(ormanager-header.html
):We've tried these routes too:
And
Using the first option we see that the favicon is broken, however we don't see in the bundle the favicon.
System:
The text was updated successfully, but these errors were encountered: