Adds meta and head-js partials to head in base.html

Allows users to add custom meta tags or javascripts to the base template

Implements: blueprint customizable-head
Change-Id: I40df3705a7ebe135d0f2843e1dcaa07e4ebcaaed
This commit is contained in:
Laura Frank 2014-01-30 11:37:53 -07:00
parent 491caf0fa9
commit 3945b70e89
5 changed files with 22 additions and 1 deletions

View File

@ -227,7 +227,24 @@ my_custom_dashboard/templates/my_custom_dashboard/base.html`` override
The result is a single compressed js file consisting both Horizon and
dashboard's custom scripts.
Additionally, some marketing and analytics scripts require you to place them
within the page's <head> tag. To do this, place them within the
``horizon/_custom_head_js.html`` file. Similar to the ``_scripts.html`` file
mentioned above, you may link to an existing file::
<script src='{{ STATIC_URL }}/my_custom_dashboard/js/my_marketing_js.js' type='text/javascript' charset='utf-8'></script>
or you can paste your script directly in the file, being sure to use
appropriate tags::
<script type="text/javascript">
//some javascript
</script>
Customizing Meta Attributes
===========================
To add custom metadata attributes to your project's base template, include
them in the ``horizon/_custom_meta.html`` file. The contents of this file will be
inserted into the page's <head> just after the default Horizon meta tags.

View File

@ -3,6 +3,7 @@
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
{% include "horizon/_custom_meta.html" %}
<title>{% block title %}{% endblock %} - {% site_branding %}</title>
{% comment %} Load CSS sheets before Javascript {% endcomment %}
{% block css %}
@ -10,6 +11,7 @@
{% endblock %}
{% include "horizon/_conf.html" %}
{% include "horizon/client_side/_script_loader.html" %}
{% include "horizon/_custom_head_js.html" %}
</head>
<body id="{% block body_id %}{% endblock %}" ng-app='horizonApp'>
{% block content %}

View File

@ -4,8 +4,10 @@
<html lang="en" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
{% include "horizon/_custom_meta.html" %}
<title>{% trans "Login" %} - {% site_branding %}</title>
{% include "_stylesheets.html" %}
{% include "horizon/_custom_head_js.html" %}
</head>
<body id="splash">
<div class="container">