From: Vladimír Vondruš Date: Thu, 2 Nov 2017 19:23:32 +0000 (+0100) Subject: theme: ability to override which menu item is highlighted. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=5fe7be860fa3ab65e19fb6e01883e998a69cee97;p=blog.git theme: ability to override which menu item is highlighted. --- diff --git a/doc/pelican/theme-test.rst b/doc/pelican/theme-test.rst index f00a82b7..7a887819 100644 --- a/doc/pelican/theme-test.rst +++ b/doc/pelican/theme-test.rst @@ -31,6 +31,7 @@ Test :css: {filename}/static/dummy.css {filename}/static/dummy.css :summary: um +:highlight: pelican/theme :header: .. note-warning:: @@ -43,4 +44,5 @@ Test This shouldn't be wrapped in a ``

``. This page should have a breadcrumb, summary in a meta tag, header and a footer -and also two additional links to ``/static/dummy.css``. +and also two additional links to ``/static/dummy.css``. It should also +highlight the Pelican Theme menu item in the top navbar. diff --git a/doc/pelican/theme.rst b/doc/pelican/theme.rst index aeb9c967..6f08f276 100644 --- a/doc/pelican/theme.rst +++ b/doc/pelican/theme.rst @@ -205,6 +205,10 @@ elsewhere; the container is marked as `inflatable <{filename}/css/grid.rst#infla Page title is rendered in an :html:`

` and there's nothing else apart from the page content. +Pages can override which menu item in the `top navbar`_ will be highlighted +by specifying the corresponding menu item slug in the :rst:`:highlight:` field. +If the field is not present, page's own slug is used instead. + `Extra CSS`_ ------------ diff --git a/pelican-theme/templates/base.html b/pelican-theme/templates/base.html index 52a421d1..11ecef68 100644 --- a/pelican-theme/templates/base.html +++ b/pelican-theme/templates/base.html @@ -34,11 +34,11 @@
    {% for title, link, slug, sub in LINKS_NAVBAR1 %}
  1. - {{ title }} + {{ title }} {% if sub %}
      {% for title, link, slug in sub %} -
    1. {{ title }}
    2. +
    3. {{ title }}
    4. {% endfor %}
    {% endif %} @@ -48,11 +48,11 @@
      {% for title, link, slug, sub in LINKS_NAVBAR2 %}
    1. - {{ title }} + {{ title }} {% if sub %}
        {% for title, link, slug in sub %} -
      1. {{ title }}
      2. +
      3. {{ title }}
      4. {% endfor %}
      {% endif %}