From d3bbe6961f71bb002575a50f1660a12494a566f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 24 Oct 2017 11:07:40 +0200 Subject: [PATCH] theme: don't repeat SITENAME if it's the same as page title. So instead of m.css | m.css on the index page one gets just m.css --- doc/pelican/theme.rst | 3 ++- pelican-theme/templates/page.html | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/pelican/theme.rst b/doc/pelican/theme.rst index 0058a9da..10e40ec5 100644 --- a/doc/pelican/theme.rst +++ b/doc/pelican/theme.rst @@ -88,7 +88,8 @@ is present. Example configuration for the builtin dark theme: THEME_COLOR = '#22272e' Value of :py:`SITENAME` is used in the :html:`` tag, separated with a -``|`` character from page / article name. +``|`` character from page / article title. If page title is the same as +:py:`SITENAME` (for example on the index page), only the page title is shown. `Top navbar`_ ------------- diff --git a/pelican-theme/templates/page.html b/pelican-theme/templates/page.html index cdd7bef7..e08d84ae 100644 --- a/pelican-theme/templates/page.html +++ b/pelican-theme/templates/page.html @@ -6,7 +6,11 @@ {% set breadcrumbs = page.breadcrumb.strip().split('\n') %} {% for i in breadcrumbs %}{% set url, _, title = i.strip().partition(' ') %}{{ title }} » {% endfor %} {% endif %} +{% if page.title == SITENAME %} +{{ page.title -}} +{% else %} {{ page.title }} | {{ SITENAME -}} +{% endif %} {% endblock %} {% block head %} -- 2.30.2