From 0328ab97f668b06bae1150d19042ac847e287d9c Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Wed, 25 Oct 2017 09:25:35 +1100 Subject: [PATCH] Add support for ogp:url and the much nicer rel="canonical", as well as smarter title handling --- lemonauth/templates/lemonauth/login.html | 1 - lemonauth/views.py | 1 + lemoncurry/templates/lemoncurry/layout.html | 10 +++++++--- lemoncurry/templatetags/lemoncurry_tags.py | 9 +++++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lemonauth/templates/lemonauth/login.html b/lemonauth/templates/lemonauth/login.html index d2ee3e5..d29e864 100644 --- a/lemonauth/templates/lemonauth/login.html +++ b/lemonauth/templates/lemonauth/login.html @@ -1,6 +1,5 @@ {% extends 'lemoncurry/layout.html' %} {% load lemonauth_tags static %} -{% block title %}log in ~ {{ block.super }}{% endblock %} {% block styles %} diff --git a/lemonauth/views.py b/lemonauth/views.py index 9a2c5ae..b16802b 100644 --- a/lemonauth/views.py +++ b/lemonauth/views.py @@ -6,6 +6,7 @@ breadcrumbs.add(route='lemonauth:login', label='log in', parent='home:index') login = auth_views.LoginView.as_view( authentication_form=OTPAuthenticationForm, + extra_context={'title': 'log in'}, template_name='lemonauth/login.html', redirect_authenticated_user=True, ) diff --git a/lemoncurry/templates/lemoncurry/layout.html b/lemoncurry/templates/lemoncurry/layout.html index b7b4855..8c4959a 100644 --- a/lemoncurry/templates/lemoncurry/layout.html +++ b/lemoncurry/templates/lemoncurry/layout.html @@ -1,12 +1,16 @@ {% load compress favtags lemoncurry_tags meta static %} - - {% block title %}{% site_name %}{% endblock %} + {% site_name as site_name %}{% request_uri request as uri %} + {% if title %}{{ title }} ~ {% endif %}{{ site_name }} - {% include 'meta/meta.html' %} + + + + {% include 'meta/meta.html' %} {% placeFavicon %} + {% compress css %} diff --git a/lemoncurry/templatetags/lemoncurry_tags.py b/lemoncurry/templatetags/lemoncurry_tags.py index f3be708..bc5731a 100644 --- a/lemoncurry/templatetags/lemoncurry_tags.py +++ b/lemoncurry/templatetags/lemoncurry_tags.py @@ -29,6 +29,15 @@ def get_package_json(): return cache.package_json +@register.simple_tag +def request_uri(request): + return '{scheme}://{host}{path}'.format( + scheme=request.scheme, + host=request.META['HTTP_HOST'], + path=request.path + ) + + @register.simple_tag def site_name(): return settings.LEMONCURRY_SITE_NAME