From c6748f5eca8480e07954bc614b850ca2a8c30334 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 2 Nov 2017 20:43:41 +0100 Subject: [PATCH] theme: apply format_siteurl to all navbar and feed links. So all URLs are absolute. --- doc/css/page-layout.rst | 6 +-- doc/pelican/theme.rst | 36 ++++++++-------- pelican-theme/templates/base.html | 28 ++++++------- site/pelicanconf.py | 70 +++++++++++++++---------------- 4 files changed, 71 insertions(+), 69 deletions(-) diff --git a/doc/css/page-layout.rst b/doc/css/page-layout.rst index f0d3862d..76135f9a 100644 --- a/doc/css/page-layout.rst +++ b/doc/css/page-layout.rst @@ -267,10 +267,10 @@ just the builtin ``m.css`` grid features:
-

Contact

+

Contact

diff --git a/doc/pelican/theme.rst b/doc/pelican/theme.rst index 6f08f276..7dd80625 100644 --- a/doc/pelican/theme.rst +++ b/doc/pelican/theme.rst @@ -135,7 +135,8 @@ to highlight currently active menu item) and fourth is a list of sub-menu items will make the menu item never highlighted; providing an empty list of sub-menu items will not add any submenu. All blog-related pages (articles, article listing, authors, tags, categories etc.) have the slug set to a special value -``[blog]``. +``[blog]``. The URL is prepended with :py:`SITEURL` unless it contains also +domain name, then it's left as-is (`detailed behavior <{filename}/plugins/htmlsanity.rst#siteurl-formatting>`_). Example configuration, matching example markup from the `CSS page layout <{filename}/css/page-layout.rst#sub-menus-in-the-navbar>`__ @@ -145,14 +146,14 @@ documentation: SITE_LOGO_TEXT = 'Your Brand' - LINKS_NAVBAR1 = [('Features', '/features/', 'features', []), - ('Showcase', '/showcase/', 'showcase', []), - ('Download', '/download/', 'download', [])] + LINKS_NAVBAR1 = [('Features', 'features/', 'features', []), + ('Showcase', 'showcase/', 'showcase', []), + ('Download', 'download/', 'download', [])] - LINKS_NAVBAR2 = [('Blog', '/blog/', '[blog]', [ - ('News', '/blog/news/', ''), - ('Archive', '/blog/archive/', '')]), - ('Contact', '/contact/', 'contact', [])] + LINKS_NAVBAR2 = [('Blog', 'blog/', '[blog]', [ + ('News', 'blog/news/', ''), + ('Archive', 'blog/archive/', '')]), + ('Contact', 'contact/', 'contact', [])] `Footer navigation`_ -------------------- @@ -167,7 +168,8 @@ given column empty. The variables are lists of 2-tuples, containing link title and URL. First item is used for column header, if link URL of the first item is empty, given column -header is just a plain :html:`

` without a link. +header is just a plain :html:`

` without a link. The URLs are processed in +the same way as in the `top navbar`_. Footer fine print can be specified via :py:`FINE_PRINT`. Contents of the variable are processed as :abbr:`reST `, so you can use all @@ -180,16 +182,16 @@ documentation, populating the last column implicitly: .. code:: py LINKS_FOOTER1 = [('Your Brand', '/'), - ('Features', '/features/'), - ('Showcase', '/showcase/')] + ('Features', 'features/'), + ('Showcase', 'showcase/')] - LINKS_FOOTER2 = [('Download', '/download/'), - ('Packages', '/download/packages/'), - ('Source', '/download/source/')] + LINKS_FOOTER2 = [('Download', 'download/'), + ('Packages', 'download/packages/'), + ('Source', 'download/source/')] - LINKS_FOOTER3 = [('Contact', '/contact/'), - ('E-mail', '#'), - ('GitHub', '#')] + LINKS_FOOTER3 = [('Contact', ''), + ('E-mail', 'mailto:you@your.brand'), + ('GitHub', 'https://github.com/your-brand')] FINE_PRINT = """ Your Brand. Copyright © `You `_, 2017. All rights diff --git a/pelican-theme/templates/base.html b/pelican-theme/templates/base.html index 11ecef68..64e517fe 100644 --- a/pelican-theme/templates/base.html +++ b/pelican-theme/templates/base.html @@ -12,10 +12,10 @@ {% endif %} {% if FEED_ALL_ATOM_URL %} - + {% endif %} {% if CATEGORY_FEED_ATOM_URL and category %} - + {% endif %} {% endblock head %} @@ -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 %} @@ -74,13 +74,13 @@
      {% if LINKS_FOOTER1 %}

      - {%- if LINKS_FOOTER1[0][1] %}{% endif %} + {%- if LINKS_FOOTER1[0][1] %}{% endif %} {{- LINKS_FOOTER1[0][0] -}} {% if LINKS_FOOTER1[0][1] -%}{% endif -%}

        {% for title, link in LINKS_FOOTER1 %}{% if loop.index0 != 0 %} -
      • {{ title }}
      • +
      • {{ title }}
      • {% endif %}{% endfor %}
      {% endif %} @@ -88,13 +88,13 @@
      {% if LINKS_FOOTER2 %}

      - {%- if LINKS_FOOTER2[0][1] %}{% endif %} + {%- if LINKS_FOOTER2[0][1] %}{% endif %} {{- LINKS_FOOTER2[0][0] -}} {% if LINKS_FOOTER2[0][1] %}{% endif -%}

        {% for title, link in LINKS_FOOTER2 %}{% if loop.index0 != 0 %} -
      • {{ title }}
      • +
      • {{ title }}
      • {% endif %}{% endfor %}
      {% endif %} @@ -103,13 +103,13 @@
      {% if LINKS_FOOTER3 %}

      - {%- if LINKS_FOOTER3[0][1] %}{% endif %} + {%- if LINKS_FOOTER3[0][1] %}{% endif %} {{- LINKS_FOOTER3[0][0] -}} {% if LINKS_FOOTER3[0][1] %}{% endif -%}

        {% for title, link in LINKS_FOOTER3 %}{% if loop.index0 != 0 %} -
      • {{ title }}
      • +
      • {{ title }}
      • {% endif %}{% endfor %}
      {% endif %} @@ -117,13 +117,13 @@
      {% if LINKS_FOOTER4 %}

      - {%- if LINKS_FOOTER4[0][1] %}{% endif %} + {%- if LINKS_FOOTER4[0][1] %}{% endif %} {{- LINKS_FOOTER4[0][0] -}} {% if LINKS_FOOTER4[0][1] %}{% endif -%}

        {% for title, link in LINKS_FOOTER4 %}{% if loop.index0 != 0 %} -
      • {{ title }}
      • +
      • {{ title }}
      • {% endif %}{% endfor %}
      {% else %} diff --git a/site/pelicanconf.py b/site/pelicanconf.py index 26e59607..91496fa4 100644 --- a/site/pelicanconf.py +++ b/site/pelicanconf.py @@ -51,48 +51,48 @@ TRANSLATION_FEED_ATOM = None AUTHOR_FEED_ATOM = None AUTHOR_FEED_RSS = None -LINKS_NAVBAR1 = [('Why?', '/why/', 'why', []), - ('CSS', '/css/', 'css', [ - ('Grid system', '/css/grid/', 'css/grid'), - ('Typography', '/css/typography/', 'css/typography'), - ('Components', '/css/components/', 'css/components'), - ('Page layout', '/css/page-layout/', 'css/page-layout'), - ('Themes', '/css/themes/', 'css/themes')]), - ('Pelican', '/pelican/', 'pelican', [ - ('Writing content', '/pelican/writing-content/', 'pelican/writing-content'), - ('Theme', '/pelican/theme/', 'pelican/theme')])] - -LINKS_NAVBAR2 = [('Pelican plugins', '/plugins/', 'plugins', [ - ('HTML sanity', '/plugins/htmlsanity/', 'plugins/htmlsanity'), - ('Components', '/plugins/components/', 'plugins/components'), - ('Images', '/plugins/images/', 'plugins/images'), - ('Math and code', '/plugins/math-and-code/', 'plugins/math-and-code'), - ('Links', '/plugins/links/', 'plugins/links')]), +LINKS_NAVBAR1 = [('Why?', 'why/', 'why', []), + ('CSS', 'css/', 'css', [ + ('Grid system', 'css/grid/', 'css/grid'), + ('Typography', 'css/typography/', 'css/typography'), + ('Components', 'css/components/', 'css/components'), + ('Page layout', 'css/page-layout/', 'css/page-layout'), + ('Themes', 'css/themes/', 'css/themes')]), + ('Pelican', 'pelican/', 'pelican', [ + ('Writing content', 'pelican/writing-content/', 'pelican/writing-content'), + ('Theme', 'pelican/theme/', 'pelican/theme')])] + +LINKS_NAVBAR2 = [('Pelican plugins', 'plugins/', 'plugins', [ + ('HTML sanity', 'plugins/htmlsanity/', 'plugins/htmlsanity'), + ('Components', 'plugins/components/', 'plugins/components'), + ('Images', 'plugins/images/', 'plugins/images'), + ('Math and code', 'plugins/math-and-code/', 'plugins/math-and-code'), + ('Links', 'plugins/links/', 'plugins/links')]), ('GitHub', 'https://github.com/mosra/m.css', '', [])] LINKS_FOOTER1 = [('m.css', '/'), - ('Why?', '/why/'), + ('Why?', 'why/'), ('GitHub', 'https://github.com/mosra/m.css'), ('Gitter', 'https://gitter.im/mosra/m.css'), ('Twitter', 'https://twitter.com/czmosra')] -LINKS_FOOTER2 = [('CSS', '/css/'), - ('Grid system', '/css/grid/'), - ('Typography', '/css/typography/'), - ('Components', '/css/components/'), - ('Page layout', '/css/page-layout/'), - ('Themes', '/css/themes/')] - -LINKS_FOOTER3 = [('Pelican', '/pelican/'), - ('Writing content', '/pelican/writing-content/'), - ('Theme', '/pelican/theme/')] - -LINKS_FOOTER4 = [('Pelican plugins', '/plugins/'), - ('HTML sanity', '/plugins/htmlsanity/'), - ('Components', '/plugins/components/'), - ('Images', '/plugins/images/'), - ('Math and code', '/plugins/math-and-code/'), - ('Links', '/plugins/links/')] +LINKS_FOOTER2 = [('CSS', 'css/'), + ('Grid system', 'css/grid/'), + ('Typography', 'css/typography/'), + ('Components', 'css/components/'), + ('Page layout', 'css/page-layout/'), + ('Themes', 'css/themes/')] + +LINKS_FOOTER3 = [('Pelican', 'pelican/'), + ('Writing content', 'pelican/writing-content/'), + ('Theme', 'pelican/theme/')] + +LINKS_FOOTER4 = [('Pelican plugins', 'plugins/'), + ('HTML sanity', 'plugins/htmlsanity/'), + ('Components', 'plugins/components/'), + ('Images', 'plugins/images/'), + ('Math and code', 'plugins/math-and-code/'), + ('Links', 'plugins/links/')] FINE_PRINT = """ m.css. Copyright © Vladimír Vondruš 2017. Site powered by `Pelican `_ -- 2.30.2