diff options
author | 2018-07-10 16:48:39 +0100 | |
---|---|---|
committer | 2018-07-10 16:48:39 +0100 | |
commit | 6155ebc3bfe09b1b0d4c58a97f8476d9849d1681 (patch) | |
tree | 564343315e9ac0533b7f9b62b56f424e1aab5f84 /templates | |
parent | All domains: sitemap.xml and robots.txt (diff) |
[Wiki] Add OG description text to pages
Descriptions are only shown for pages with a `header::` block
Diffstat (limited to 'templates')
-rw-r--r-- | templates/wiki/page_view.html | 5 |
1 files changed, 4 insertions, 1 deletions
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 %} |