djangosnippets.org: Latest snippets posted by benjy_mousehttps://djangosnippets.org/users/benjy_mouse/2010-02-13T01:56:28.387434-06:00benjy_mousefavicon Template Tag
2010-02-13T01:56:28.387434-06:00benjy_mousehttps://djangosnippets.org/snippets/1923/<p>A simple template tag that returns the favicon URL for a given arbitrary URL.</p>
<p>Put the code into a python module in the templatetags package of a Django app (e.g. myapp/templatetags/mytags.py), and use it like this:</p>
<pre><code>{% load mytags %}
...
<img src="{% favicon posting.url %}/>
<a href="{{ posting.url }}">{{posting.title}}</a> …</code></pre>
Freely redistributable