From: Vladimír Vondruš Date: Tue, 24 Oct 2017 09:07:40 +0000 (+0200) Subject: theme: don't repeat SITENAME if it's the same as page title. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=d3bbe6961f71bb002575a50f1660a12494a566f6;p=blog.git 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 --- 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 %}