diff --git a/Pipfile b/Pipfile
index eabac3c..0981ea0 100644
--- a/Pipfile
+++ b/Pipfile
@@ -29,6 +29,7 @@ xrd = "*"
django-push = "*"
pyyaml = "*"
django-annoying = "*"
+django-shorturls = "*"
[dev-packages]
diff --git a/Pipfile.lock b/Pipfile.lock
index ac62fae..bc1d7db 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "60cccca3a3edbe0c10266ab3641a32cf61223145a35203eae215af023f88d350"
+ "sha256": "3f9a75dcd0609cd38fc01d23b8f2e198e494f5ab7120e5bb8af08b909a16ea52"
},
"host-environment-markers": {
"implementation_name": "cpython",
@@ -157,6 +157,12 @@
],
"version": "==1.7.1"
},
+ "django-shorturls": {
+ "hashes": [
+ "sha256:382ff617b36fea04981b30457377a46f2034d0940a40a20c6f637c55ea0bda93"
+ ],
+ "version": "==2.0.0"
+ },
"gunicorn": {
"hashes": [
"sha256:75af03c99389535f218cc596c7de74df4763803f7b63eb09d77e92b3956b36c6",
diff --git a/entries/templates/entries/entry.html b/entries/templates/entries/entry.html
index a007efd..0d51d25 100644
--- a/entries/templates/entries/entry.html
+++ b/entries/templates/entries/entry.html
@@ -1,5 +1,7 @@
{% extends 'lemoncurry/layout.html' %}
-{% load static %}
+{% load shorturl static %}
+
+{% block head %}{% revcanonical entry %}{% endblock %}
{% block styles %}
diff --git a/lemoncurry/settings/base.py b/lemoncurry/settings/base.py
index 802ff90..5bfb2da 100644
--- a/lemoncurry/settings/base.py
+++ b/lemoncurry/settings/base.py
@@ -78,6 +78,7 @@ INSTALLED_APPS = [
'django_otp.plugins.otp_totp',
'favicon',
'meta',
+ 'shorturls',
'lemoncurry',
'entries',
@@ -209,6 +210,12 @@ SITE_ID = 1
# https://pythonhosted.org/django-agent-trust/
AGENT_COOKIE_SECURE = True
+# django-shorturls
+# https://pypi.python.org/pypi/django-shorturls
+SHORTEN_MODELS = {
+ 'e': 'entries.entry',
+}
+
# django-meta
# https://django-meta.readthedocs.io/en/latest/settings.html
META_SITE_PROTOCOL = 'https'
diff --git a/lemoncurry/templates/lemoncurry/layout.html b/lemoncurry/templates/lemoncurry/layout.html
index c2bff64..06b9be9 100644
--- a/lemoncurry/templates/lemoncurry/layout.html
+++ b/lemoncurry/templates/lemoncurry/layout.html
@@ -6,6 +6,7 @@
+ {% block head %}{% endblock %}
diff --git a/lemoncurry/urls.py b/lemoncurry/urls.py
index af66781..55e1b4a 100644
--- a/lemoncurry/urls.py
+++ b/lemoncurry/urls.py
@@ -39,6 +39,7 @@ urlpatterns = [
url('^.well-known/', include('wellknowns.urls')),
url('^admin/', otp_admin_site.urls),
url('^auth/', include('lemonauth.urls')),
+ url('^s/', include('shorturls.urls')),
url(r'^sitemap\.xml$', sitemap.index, maps),
url(r'^sitemaps/(?P.+)\.xml$', sitemap.sitemap, maps,