From 16730e8b46265a2940166464ecb623be7bb57ff4 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Fri, 2 Oct 2020 21:12:18 +0200 Subject: [PATCH 01/12] Update feed generation to match Zola update --- README.md | 2 ++ templates/index.html | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9310289..feccdad 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,8 @@ zulma_allow_theme_selection = true This template is based on the [blog template](https://bulmatemplates.github.io/bulma-templates/templates/blog.html) over at [Free Bulma Templates](https://bulmatemplates.github.io/bulma-templates/). All themes were taken from [Bulmaswatch](https://jenil.github.io/bulmaswatch/). The code behind from originally adapted from the [after-dark](https://github.com/getzola/after-dark/blob/master/README.md) zola template. +This theme was modified by trotFunky from Worble's work on [github](https://github.com/Worble/Zulma). + ## Known Bugs - If user theme swapping is enabled and the user selects a theme different to the default, a slight delay will be introduced in page rendering as the css gets swapped out and in by the javascript. This is particularly pronounced when using the dark theme, since it will flash white before going back to black. This is better than the alternative flashes of unstyled content or old theme, but still annoying. I don't know any way around this, but with browser caching it should be fast enough to not cause serious issues. diff --git a/templates/index.html b/templates/index.html index 14f5406..8809829 100644 --- a/templates/index.html +++ b/templates/index.html @@ -25,8 +25,8 @@ {% endif %} - {% if config.generate_rss %} - + {% if config.generate_feed %} + {% endif %} {% if config.build_search_index %} From 2d6b0f81737f90c3d79e5b610bebc5788ad7c4e1 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Fri, 2 Oct 2020 21:04:10 +0200 Subject: [PATCH 02/12] Update feed generation to match Zola update --- README.md | 2 ++ templates/index.html | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9310289..feccdad 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,8 @@ zulma_allow_theme_selection = true This template is based on the [blog template](https://bulmatemplates.github.io/bulma-templates/templates/blog.html) over at [Free Bulma Templates](https://bulmatemplates.github.io/bulma-templates/). All themes were taken from [Bulmaswatch](https://jenil.github.io/bulmaswatch/). The code behind from originally adapted from the [after-dark](https://github.com/getzola/after-dark/blob/master/README.md) zola template. +This theme was modified by trotFunky from Worble's work on [github](https://github.com/Worble/Zulma). + ## Known Bugs - If user theme swapping is enabled and the user selects a theme different to the default, a slight delay will be introduced in page rendering as the css gets swapped out and in by the javascript. This is particularly pronounced when using the dark theme, since it will flash white before going back to black. This is better than the alternative flashes of unstyled content or old theme, but still annoying. I don't know any way around this, but with browser caching it should be fast enough to not cause serious issues. diff --git a/templates/index.html b/templates/index.html index 14f5406..8809829 100644 --- a/templates/index.html +++ b/templates/index.html @@ -25,8 +25,8 @@ {% endif %} - {% if config.generate_rss %} - + {% if config.generate_feed %} + {% endif %} {% if config.build_search_index %} From ac5828cde455a594b11c68bc0ad8b306256cd0b6 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Fri, 2 Oct 2020 21:12:24 +0200 Subject: [PATCH 03/12] Add basic support for multilingual site Add language switcher on the top right of the site Switches taxonomies, article paths, home, etc. Every language is independent --- templates/index_macros.html | 44 +++++++++++++++++++++++++++++++++++-- templates/post_macros.html | 6 ++--- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/templates/index_macros.html b/templates/index_macros.html index 7e7e938..bd90f75 100644 --- a/templates/index_macros.html +++ b/templates/index_macros.html @@ -58,7 +58,11 @@
{% endif %} + + {% if config.languages %} + {% if config.default_language is not matching(lang) %} + {% set lang_url = current_url | replace(from=config.base_url ~ "/" ~ lang, to=config.base_url) %} + + {% endif %} + {% for available_lang in config.languages %} + {% set lang_code = available_lang.code %} + {% if lang_code is not matching(lang) %} + + {% if lang is matching(config.default_language) %} + {% set lang_url = current_url | replace(from=config.base_url ~ "/", to=config.base_url ~ "/" ~ lang_code ~ "/") %} + {% else %} + {% set lang_url = current_url | replace(from=config.base_url ~ "/" ~ lang, to=config.base_url ~ "/" ~ lang_code) %} + {% endif %} + + {% endif %} + {% endfor %} + {% endif %} +
diff --git a/templates/post_macros.html b/templates/post_macros.html index c057f83..b460bf1 100644 --- a/templates/post_macros.html +++ b/templates/post_macros.html @@ -93,7 +93,7 @@ {% if page.taxonomies.authors %} by {% for author in page.taxonomies.authors %} - + {{ author }} {% if page.taxonomies.authors | length > 1 %} @@ -113,7 +113,7 @@ and {% macro post_footer_categories(page) %} {% if page.taxonomies.categories %} {% set category = page.taxonomies.categories[0] %} -in +in {{ category }} @@ -126,7 +126,7 @@ in {% if page.taxonomies.tags %} and tagged {% for tag in page.taxonomies.tags %} - + {{ tag }} {% if page.taxonomies.tags | length > 1 %} From e933a44125d00df57eb41ceaa28c52c1feb56e23 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Fri, 2 Oct 2020 21:05:35 +0200 Subject: [PATCH 04/12] Add basic support for multilingual site Add language switcher on the top right of the site Switches taxonomies, article paths, home, etc. Every language is independent --- templates/index_macros.html | 44 +++++++++++++++++++++++++++++++++++-- templates/post_macros.html | 6 ++--- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/templates/index_macros.html b/templates/index_macros.html index 7e7e938..bd90f75 100644 --- a/templates/index_macros.html +++ b/templates/index_macros.html @@ -58,7 +58,11 @@
{% endif %} + + {% if config.languages %} + {% if config.default_language is not matching(lang) %} + {% set lang_url = current_url | replace(from=config.base_url ~ "/" ~ lang, to=config.base_url) %} + + {% endif %} + {% for available_lang in config.languages %} + {% set lang_code = available_lang.code %} + {% if lang_code is not matching(lang) %} + + {% if lang is matching(config.default_language) %} + {% set lang_url = current_url | replace(from=config.base_url ~ "/", to=config.base_url ~ "/" ~ lang_code ~ "/") %} + {% else %} + {% set lang_url = current_url | replace(from=config.base_url ~ "/" ~ lang, to=config.base_url ~ "/" ~ lang_code) %} + {% endif %} + + {% endif %} + {% endfor %} + {% endif %} +
diff --git a/templates/post_macros.html b/templates/post_macros.html index c057f83..b460bf1 100644 --- a/templates/post_macros.html +++ b/templates/post_macros.html @@ -93,7 +93,7 @@ {% if page.taxonomies.authors %} by {% for author in page.taxonomies.authors %} - + {{ author }} {% if page.taxonomies.authors | length > 1 %} @@ -113,7 +113,7 @@ and {% macro post_footer_categories(page) %} {% if page.taxonomies.categories %} {% set category = page.taxonomies.categories[0] %} -in +in {{ category }} @@ -126,7 +126,7 @@ in {% if page.taxonomies.tags %} and tagged {% for tag in page.taxonomies.tags %} - + {{ tag }} {% if page.taxonomies.tags | length > 1 %} From cb55cd17d135de8de8ffcfebf737ec3519e02ea6 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Fri, 2 Oct 2020 23:03:35 +0200 Subject: [PATCH 05/12] Shrink hero banner --- sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass b/sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass index d988040..dccb47d 100644 --- a/sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass +++ b/sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass @@ -153,4 +153,4 @@ .hero-body flex-grow: 1 flex-shrink: 0 - padding: 3rem 1.5rem + padding: 1.5rem From e53382eaa0a1d563856b5a4c7c0ee0863f855840 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Fri, 2 Oct 2020 23:03:35 +0200 Subject: [PATCH 06/12] Shrink hero banner --- sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass b/sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass index d988040..dccb47d 100644 --- a/sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass +++ b/sass/_vendor/bulma-0.7.4/sass/layout/_hero.sass @@ -153,4 +153,4 @@ .hero-body flex-grow: 1 flex-shrink: 0 - padding: 3rem 1.5rem + padding: 1.5rem From 242a276c92a7903c008353ac17279df62d53ec88 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Sat, 3 Oct 2020 00:09:39 +0200 Subject: [PATCH 07/12] Added themed 404 page Currently requires a hacky fix of the index.html template as the 404 only has the config in its context. --- templates/404.html | 28 ++++++++++++++++++++++++++++ templates/index_macros.html | 12 ++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 templates/404.html diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..36e9bab --- /dev/null +++ b/templates/404.html @@ -0,0 +1,28 @@ +{% extends "index.html" %} +{% import "post_macros.html" as post_macros %} + +{% block content %} + +{% block header %} +{{ super() }} +{% endblock header %} + +
+
+
+
+
+
+
+
+

404!

+ This page could not be found, perhaps it is not available in the current language or simply does not exist. +
+
+
+
+
+
+
+
+{% endblock content %} \ No newline at end of file diff --git a/templates/index_macros.html b/templates/index_macros.html index bd90f75..56c4091 100644 --- a/templates/index_macros.html +++ b/templates/index_macros.html @@ -53,6 +53,18 @@ {% macro navbar() %} {% if config.extra.zulma_menu or config.extra.zulma_brand or config.build_search_index %} + +{# This is used for the 404 template, as it only gets the config in its context. + This is clearly hacky and should be changed eventually #} + +{% if not lang %} +{% set lang = config.default_language %} +{% endif %} + +{% if not current_url %} +{% set current_url = config.base_url %} +{% endif %} +