Open ucheNkadiCode opened 11 months ago
What does "unable to change" it mean? That the browser isn't picking up the new image? Browsers cache favicons very aggressively.
What does "unable to change" it mean? That the browser isn't picking up the new image? Browsers cache favicons very aggressively.
@Conduitry, How would you suggest I overcome the aggressive caching? It's a really simple site and my static folder looks like so. All advice online looks the same
A very weird issue I see is that all of the lines that are supposed to be added to the head are showing up in the body. However, when I move all these same lines to
If I edit the <head>
element in my developer console by adding <link rel="icon" href="/favicon/favicon.ico">
at the bottom, it actually finds my icon and looks great. So this leads me to believe that the key reason is both the svelte:head
and <head>
elements are somehow getting injected into the <body>
when I'm doing npm dev run
Please provide a minimal reproduction in the form of a repository
Thanks @eltigerchino and @Conduitry - here is a reproducer -> https://github.com/ucheNkadiCode/faviconBug/tree/main
After a bit more tweaking, what I see is that the issue may have been that I was using <svelte:head>
in the app.html
file. When I instead moved my line <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" />
to <head>
and got rid of <svelte:head<
completely in html -> those contents are no longer being placed in the content body.
It's a pretty weird bug. I don't know if it is expected behavior but I believe your docs would need to be updated to reflect this specific nuance.
My app.html
now looks like this
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" />
<link rel="apple-touch-icon" sizes="180x180" href="%sveltekit.assets%/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="%sveltekit.assets%/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="%sveltekit.assets%/favicon/favicon-16x16.png">
<link rel="manifest" href="%sveltekit.assets%/favicon/site.webmanifest">
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
Yeah, Svelte syntax shouldn’t be used inside a HTML file. I wonder if we should throw an error for this or have some kind of HTML file validation?
That would be super helpful!
And/Or just adding something in the docs about svelte head not being available in app.html could have saved me a lot of time.
Thanks for the help, this solved my issue
Describe the bug
My package JSON
My app.html file is such
I've tried what feels like everything and used favicon.io to create my images. I then created a favicon folder in the static folder which should work, but nothing is working. I've also tried moving these links into svelte:head but that didn't work either.
Am I missing something? Could it be an issue in the
svelte.config.js
file? It's not working locally nor on the deployed website.Reproduction
It's svelte app created with the basic template
Logs
No response
System Info
Severity
annoyance
Additional Information
No response