-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Clarify favicon addition instructions in documentation #41838
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
base: main
Are you sure you want to change the base?
Conversation
Updated instructions for adding favicons to make them clearer.
|
Preview URLs
Flaws (5)URL:
URL:
External URLs (1)URL:
(comment last updated: 2025-11-13 15:53:26) |
|
|
||
| 1. Saving it in the same directory as the site's index page, saved in `.ico` format (most also support favicons in more common formats like `.gif` or `.png`) | ||
| 2. Adding the following line into your HTML's {{HTMLElement("head")}} block to reference it: | ||
| 1. Saving it in a supported format such as `.ico`, `.gif`, or `.png` somewhere inside your website directory (in this example, it would be saved in the same directory as the HTML file). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the main confusion is that we are mixing "directory" and "URL". If you use any framework the "directory" of the site (if there's such a concept at all) is not going to be the same thing as the root URL (such as the OP which has templates as the site directory, but not every file under templates will become the root of the site). Rather, you want to serve the favicon at /favicon.ico via whatever capability your tool provides, such as a static or public folder. Although you can technically place it anywhere, it's canonically at /favicon.ico, because if you do so you don't have to add a <link> at all: all browsers can automatically get this icon. Some external tools might even not read the HTML document at all and assume favicons at this location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to me like you're overthinking this. Here we are talking about basic, static HTML, and by "directory", I'm talking about the physical folder on your computer. The reader of this is unlikely to be using a framework. Maybe I should just say "folder", update the URL to "/favicon.ico", and mention in a note that if it is placed here, most browsers will pick it up automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello. I have set up the framework 'Flask' some time ago, and this was indeed what confused me. As time passed, and my experience with web development being quite new, I somehow considered the Flask directories architecture as a basic HTML one. I only heard about the addition of favicons being a thing in Flask a day or two later in its documentation. I guess a small note talking about this would be nice? This was a head scratcher for me. I hope you won't curse me and my family for 10 generations, @chrisdavidmills.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Odysseus-GH24 I stand corrected! I think the curses are all mine ;-)
Seriously, this is really interesting direct reader feedback, and also highlights the danger of making assumptions.
I'll update it tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've made some more updates. I also took this opportunity to update the paths and URLs primer, to add some more details, distinguish between paths and URLs, and show how the two relate. That stuff was originally written about 10 years ago...
Odysseus-GH24
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @chrisdavidmills. I read the favicon part and the note you wrote is great! I find it clear and easy to understand.
Description
Updated instructions for adding favicons to make them clearer.
Motivation
Additional details
Related issues and pull requests
Fixes #41837