Search code examples
htmlfavicon

favicon not showing up in any way


I have in my index.html, between my <head> tags the following line of code:

{% block head %}
  <link type="image/x-icon" rel="shortcut icon" href='static/img/favicon.ico'/>
{% endblock %}

This is not working somehow. But if I go to: 'http://127.0.0.1:5000/static/img/favicon.ico' The favicon shows up. So this means that the favicon works, it's displayable but I can't find a way to put it next to the URL as it should be. Thanks in advance


Solution

  • From your code, you have given and the URL provided it looks like it is a flask app.

    If it is flask you need to load the static files as follows, which will help you to load the favicon as well.

    <link rel="shortcut icon"
        href="{{ url_for('static', filename='img/favicon.ico') }}">