From: Vladimír Vondruš Date: Sat, 9 Dec 2017 21:40:05 +0000 (+0100) Subject: theme: nice defaults if M_BLOG_{NAME,URL} / M_SITE_LOGO_TEXT not defined. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=23528830b7b3647ea1bf4b0030b9ddcda94cc9fe;p=blog.git theme: nice defaults if M_BLOG_{NAME,URL} / M_SITE_LOGO_TEXT not defined. --- diff --git a/doc/pelican/theme.rst b/doc/pelican/theme.rst index 66c9c53b..0cef2845 100644 --- a/doc/pelican/theme.rst +++ b/doc/pelican/theme.rst @@ -115,7 +115,9 @@ of the website with pages is treated differently from the "blog" part with articles and there are two additional configuration options :py:`M_BLOG_URL` and :py:`M_BLOG_NAME` that control how various parts of the theme link to the blog and how blog pages are named in the :html:`` element. The :py:`M_BLOG_URL` -can be either absolute or relative to :py:`SITEURL`. +can be either absolute or relative to :py:`SITEURL`. If :py:`M_BLOG_NAME` / +:py:`M_BLOG_URL` are not set, the theme assumes they are the same as +:py:`SITENAME` / :py:`SITEURL`. .. code:: py @@ -130,8 +132,9 @@ can be either absolute or relative to :py:`SITEURL`. :py:`M_SITE_LOGO` is an image file that will be used as a brand logo on left side of the navbar, :py:`M_SITE_LOGO_TEXT` is brand logo text. Specifying just -one of these does the expected thing. The brand logo/text is a link that leads -to :py:`SITTEURL`. +one of these does the expected thing, if neither of them is specified, the +theme will use :py:`SITENAME` in place of :py:`M_SITE_LOGO_TEXT`. The brand +logo/text is a link that leads to :py:`SITTEURL`. :py:`M_LINKS_NAVBAR1` and :py:`M_LINKS_NAVBAR2` variables contain links to put in the top navbar. On narrow screens, the navbar is divided into two columns, diff --git a/pelican-theme/templates/base.html b/pelican-theme/templates/base.html index 6078e60c..f7b5c026 100644 --- a/pelican-theme/templates/base.html +++ b/pelican-theme/templates/base.html @@ -25,7 +25,7 @@ <div class="m-row"> <a href="{{ SITEURL }}/" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m{% if page and page.landing and page.cover and page.navbar_brand_hidden == 'True' %} m-navbar-brand-hidden{% endif %}"> {%- if M_SITE_LOGO %}<img src="{{ M_SITE_LOGO }}" />{% endif -%} - {{- M_SITE_LOGO_TEXT -}} + {{- M_SITE_LOGO_TEXT or SITENAME -}} </a> <a id="m-navbar-show" href="#navigation" title="Show navigation" class="m-col-t-3 m-hide-m m-text-right"></a> <a id="m-navbar-hide" href="#" title="Hide navigation" class="m-col-t-3 m-hide-m m-text-right"></a> diff --git a/pelican-theme/templates/base_blog.html b/pelican-theme/templates/base_blog.html index f0ad50e2..3bb8b469 100644 --- a/pelican-theme/templates/base_blog.html +++ b/pelican-theme/templates/base_blog.html @@ -1,4 +1,5 @@ {% set page_slug = '[blog]' %} +{% if not M_BLOG_NAME %}{% set M_BLOG_NAME = SITENAME %}{% endif %} {% extends 'base.html' %} {% block title %}{{ M_BLOG_NAME }}{% endblock %}