From 18732081d582fce4c2a2bdf3abb1670d1651a768 Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Tue, 2 Feb 2021 17:56:40 +0200 Subject: [PATCH] add a sidebar and format it Note the sidebar needs to be "included", use sed instead of Jinja2 https://github.com/getnikola/plugins/issues/375 --- Makefile | 7 ++++++ themes/pypy/assets/css/styles.css | 34 ++++++++++++++++++++++++- themes/pypy/messages/messages_en.py | 8 ++++-- themes/pypy/templates/base_header.tmpl | 2 +- themes/pypy/templates/index.tmpl | 9 ++++++- themes/pypy/templates/post.tmpl | 35 +++++++++++++++----------- 6 files changed, 75 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 3a394ca4..19652c59 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +SHELL := bash # pypy.org static page and blog makefile # type `make help` to see all options @@ -14,6 +15,7 @@ all: build venv_nikola/bin/nikola: ## create a virtualenv to build the website > @virtualenv -ppython3 ./venv_nikola > @venv_nikola/bin/python -mpip install nikola==8.0.3 jinja2 aiohttp watchdog ruamel.yaml feedparser +> @venv_nikola/bin/nikola plugin -i sidebar plugins/import_blogger: venv_nikola/bin/nikola > venv_nikola/bin/nikola plugin -i import_blogger @@ -21,6 +23,11 @@ plugins/import_blogger: venv_nikola/bin/nikola build: venv_nikola/bin/nikola ## build the website if needed, the result is in ./public > venv_nikola/bin/nikola build +> @for f in $$(grep "include.*sidebar-en.inc" -lr public/) ;do \ +> sed -i -e'//r public/sidebar-en.inc' $$f; \ +> sed -i -e'//d' $$f; \ +> echo $${f}; \ +> done; auto: venv_nikola/bin/nikola ## build and serve the website, autoupdate on changes > venv_nikola/bin/nikola auto -a 0.0.0.0 diff --git a/themes/pypy/assets/css/styles.css b/themes/pypy/assets/css/styles.css index f99dd18f..84199a51 100644 --- a/themes/pypy/assets/css/styles.css +++ b/themes/pypy/assets/css/styles.css @@ -37,6 +37,27 @@ pre.literal-block *:last-child { height: 32px; } +#footer { + border-top: 1px solid #4F5151; + clear: both; +} + +#container { + margin: 1em auto; + max-width: 75%; +} + +.post { + float: left; + width: 70%; +} + + +div.sidebar { + float: left; + width: 27%; +} + .logotext { padding-top: 4px; } @@ -75,7 +96,18 @@ pre.literal-block *:last-child { @media screen and (max-width: 40rem) { .row .column { - text-align: center; } } + text-align: center; } + div.sidebar { + display: none; + } + #container { + max-width: 100%; + } + div.post { + width: 95%; + } +} + .pb-4 { padding-bottom: 6rem; } diff --git a/themes/pypy/messages/messages_en.py b/themes/pypy/messages/messages_en.py index 3bfd5ea9..0cdfac82 100644 --- a/themes/pypy/messages/messages_en.py +++ b/themes/pypy/messages/messages_en.py @@ -4,6 +4,10 @@ "No comments.": "No comments.", "{0} wrote on {1}:": "{0} wrote on {1}:", "No comments": "No comments", - "{0} comment": "{0} comment", - "{0} comments": "{0} comments", + "{0} comment": "{0} comment", + "{0} comments": "{0} comments", + "Recent Posts": "Recent Posts", + "Archives": "Archives", + "Categories": "Categories", + "Tags": "Tags", } diff --git a/themes/pypy/templates/base_header.tmpl b/themes/pypy/templates/base_header.tmpl index ec6dd017..71c72752 100644 --- a/themes/pypy/templates/base_header.tmpl +++ b/themes/pypy/templates/base_header.tmpl @@ -24,7 +24,7 @@