Add support for ogp:url and the much nicer rel="canonical", as well as smarter title handling

This commit is contained in:
Danielle McLean 2017-10-25 09:25:35 +11:00
parent 57b14e01ce
commit 0328ab97f6
Signed by: 00dani
GPG Key ID: 5A5D2D1AFF12EEC5
4 changed files with 17 additions and 4 deletions

View File

@ -1,6 +1,5 @@
{% extends 'lemoncurry/layout.html' %}
{% load lemonauth_tags static %}
{% block title %}log in ~ {{ block.super }}{% endblock %}
{% block styles %}
<link rel="stylesheet" type="text/stylus" href="{% static 'lemonauth/css/login.styl' %}" />

View File

@ -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,
)

View File

@ -1,12 +1,16 @@
{% load compress favtags lemoncurry_tags meta static %}<!doctype html>
<html lang="en" class="{% block html_class %}{% endblock %}">
<head{% meta_namespaces %}>
<title class="p-name">{% block title %}{% site_name %}{% endblock %}</title>
<head{% meta_namespaces %}>{% site_name as site_name %}{% request_uri request as uri %}
<title class="p-name">{% if title %}{{ title }} ~ {% endif %}{{ site_name }}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
{% include 'meta/meta.html' %}
<link rel="canonical" href="{{ uri }}" />
<meta property="og:url" content="{{ uri }}" />
<meta property="og:title" content="{% firstof title site_name %}" />
{% include 'meta/meta.html' %}
{% placeFavicon %}
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"
integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous" />
{% compress css %}

View File

@ -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