Set <base> on every page

This commit is contained in:
Danielle McLean 2017-10-26 15:57:44 +11:00
parent a7e71525f4
commit 8e974e3745
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
2 changed files with 8 additions and 3 deletions

View file

@ -1,6 +1,7 @@
{% load compress favtags lemoncurry_tags meta static %}<!doctype html>
<html lang="en" class="{% block html_class %}{% endblock %}">
<head{% meta_namespaces %}>{% site_name as site_name %}{% request_uri request as uri %}
<base href="{% request_origin request %}" />
<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" />

View file

@ -30,14 +30,18 @@ def get_package_json():
@register.simple_tag
def request_uri(request):
return '{scheme}://{host}{path}'.format(
def request_origin(request):
return '{scheme}://{host}'.format(
scheme=request.scheme,
host=request.META['HTTP_HOST'],
path=request.path
)
@register.simple_tag
def request_uri(request):
return request_origin(request) + request.path
@register.simple_tag
def site_name():
return settings.LEMONCURRY_SITE_NAME