Added SITE_TITLE and layout block head_title to manage <title /> tag

This commit is contained in:
Felipe Martín 2013-05-24 12:37:27 +02:00
parent 71411af9bf
commit 1d63c5c39c
5 changed files with 22 additions and 3 deletions

View File

@ -1,5 +1,9 @@
{% extends "layout.html" %}
{% block head_title %}
{{ super() }} | About
{% endblock %}
{% block content %}
About page
{% endblock %}

View File

@ -4,7 +4,8 @@
<link rel="stylesheet" href="/static/lib/font-awesome.3.1.1.css" />
<link rel="stylesheet" href="/static/lib/bootstrap.css" />
<link rel="stylesheet" href="/static/lib/responsive.css" />
<title>Title</title>
{% include "head.html" %}
<title>{% block head_title %}{{ site_title }}{% endblock %}</title>
</head>
<body>
<header>

View File

@ -1,5 +1,9 @@
{% extends "layout.html" %}
{% block head_title %}
{{ super() }} | Versions
{% endblock %}
{% block content %}
<table class="table table-bordered">
<thead>

View File

@ -1,8 +1,14 @@
from django.conf import settings
def templateContext(request):
def TemplateContext(request):
result = {}
if hasattr(settings, 'TEMPLATE_CONTEXT'):
for item in settings.TEMPLATE_CONTEXT:
result[item[0]] = item[1]
return result
def SiteTitleContext(request):
return {
'site_title': settings.SITE_TITLE
}

View File

@ -94,7 +94,8 @@ TEMPLATE_LOADERS = (
)
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'herobrine.context.templateContext',
'herobrine.context.TemplateContext',
'herobrine.context.SiteTitleContext',
)
JINGO_INCLUDE_PATTERN = r'\.html'
@ -147,6 +148,9 @@ JINJA_CONFIG = {
}
#from herobrine import filters
# SITE TITLE
SITE_TITLE = 'MinecraftCodex'
try:
LOCAL_SETTINGS