Adding template tag to render the microsite favicon

This commit is contained in:
Felipe Montoya
2014-04-02 17:16:05 -05:00
parent f683a4c576
commit e64d09fdd8
2 changed files with 11 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ based on the current micro site.
from django import template
from django.conf import settings
from microsite_configuration import microsite
from django.templatetags.static import static
register = template.Library()
@@ -38,3 +39,12 @@ def platform_name():
{% platform_name %}
"""
return microsite.get_value('platform_name', settings.PLATFORM_NAME)
@register.simple_tag(name="favicon_path")
def favicon_path(default=settings.FAVICON_PATH):
"""
Django template tag that outputs the configured favicon:
{% favicon_path %}
"""
return static(microsite.get_value('favicon_path', default))

View File

@@ -5,7 +5,7 @@
<meta charset="UTF-8">
{% block title %}<title>{% platform_name %}</title>{% endblock %}
<link rel="icon" type="image/x-icon" href="{% static "images/favicon.ico" %}" />
<link rel="icon" type="image/x-icon" href="{% favicon_path %}" />
{% compressed_css 'style-vendor' %}
{% compressed_css 'style-app' %}