0

I try to learn flask. My test is mainly based on this blog. I would like to change the icon right next the title. Here is my base.html :

<html>
<head>
<link rel="flask" href="../static/flask.ico" type="image/x-icon">
{% if title %}
    <title>{{ title }} - microblog</title>
{% else %}
<title>Weclome to microblog</title>
{% endif %}
</head>
<body>
    <div>Microblog: <a href="/index">Home</a></div>
    <div>Ajout: <a href="add">Add</a></div>
    <div>Clean: <a href="clean">Clean</a></div>
    <hr>
    {% block content %}{% endblock %}
</body>
</html>

The base.html is in the template/ folder and the flask.ico is in static/. So all the html pages that inherite from it, should have the new icon. But it doesn't work.

I have already tried:

<link rel="flask" href="static/flask.ico" type="image/x-icon">
<link rel="flask" href="static/flask.png" type="image/png">
<link rel="flask" href="{{ url_for('static', filename='flask.ico') }}" type="image/x-icon">
<link rel="flask" href="http://icons.iconarchive.com/icons/paomedia/small-n-flat/24/flask-icon.png" type="image/png">

And none of this has worked. Thanks for your replay.

edit: the solution was to change rel="flask" for rel="icon". Thanks

hallow_me
  • 1,203
  • 10
  • 16

1 Answers1

3

As per W3C ruling, the preferred method to add a favicon to a page is to use rel="icon".

Example:

<link rel="icon" 
      type="image/png" 
      href="http://example.com/myicon.png">
JRodDynamite
  • 12,325
  • 5
  • 43
  • 63