From 6155ebc3bfe09b1b0d4c58a97f8476d9849d1681 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Tue, 10 Jul 2018 16:48:39 +0100 Subject: [Wiki] Add OG description text to pages Descriptions are only shown for pages with a `header::` block --- templates/wiki/page_view.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/wiki/page_view.html b/templates/wiki/page_view.html index c660ed6d..aa560390 100644 --- a/templates/wiki/page_view.html +++ b/templates/wiki/page_view.html @@ -1,7 +1,10 @@ {% extends "wiki/base.html" %} {% block title %}Wiki | {{ data["title"] }}{% endblock %} {% block og_title %}Wiki | {{ data["title"] }}{% endblock %} -{% block og_description %}{% endblock %} + +{# To be safe about whitespace formatting on various platforms, we do everything one one line here #} +{% block og_description %}{% if data.rst.startswith(".. header::") %}{{ data.text.split("\n", 1)[0] }}{% endif %}{% endblock %} + {% block page_classes %}uses-rst{% endblock %} {% block content %} -- cgit v1.2.3