From 14013e78345b26f6bbbeaead40135841f585da1e Mon Sep 17 00:00:00 2001 From: zaaarf Date: Tue, 2 Jan 2024 12:18:18 +0100 Subject: [PATCH] chore: internal refactor --- sass/_logo.scss | 13 ++-- sass/_main.scss | 10 +-- templates/404.html | 4 +- templates/base-page.html | 15 ---- templates/base.html | 20 ------ templates/footer.html | 13 ---- templates/head.html | 91 ++++++++++-------------- templates/header.html | 28 -------- templates/index.html | 2 +- templates/logo.html | 29 -------- templates/macros/marginals.html | 78 ++++++++++++++++++++ templates/{toc.html => macros/post.html} | 14 +++- templates/page.html | 46 ++++++++++-- templates/{blog-page.html => post.html} | 9 +-- templates/section.html | 2 +- templates/tags/list.html | 4 +- templates/tags/single.html | 4 +- 17 files changed, 191 insertions(+), 191 deletions(-) delete mode 100644 templates/base-page.html delete mode 100644 templates/base.html delete mode 100644 templates/footer.html delete mode 100644 templates/header.html delete mode 100644 templates/logo.html create mode 100644 templates/macros/marginals.html rename templates/{toc.html => macros/post.html} (63%) rename templates/{blog-page.html => post.html} (81%) diff --git a/sass/_logo.scss b/sass/_logo.scss index f70245d..1469456 100644 --- a/sass/_logo.scss +++ b/sass/_logo.scss @@ -10,15 +10,20 @@ height: 44px; } - &__mark { + &-link { + text-decoration: none; + float: left; + } + + &-mark { margin-right: 5px; } - &__text { + &-text { white-space: nowrap; } - &__cursor { + &-cursor { display: inline-block; width: 10px; height: 1.5rem; @@ -29,7 +34,7 @@ } @media (prefers-reduced-motion: reduce) { - &__cursor { + &-cursor { animation: none; } } diff --git a/sass/_main.scss b/sass/_main.scss index ada787e..f0d7eb2 100644 --- a/sass/_main.scss +++ b/sass/_main.scss @@ -12,12 +12,6 @@ } } -:root.light { - .darkOnly { - display: none; - } -} - ::-moz-selection, ::selection { color: var(--bgColor); background: var(--fgColor); @@ -161,13 +155,13 @@ footer { color: var(--fgColor); background-color: transparent; - &__background:hover, &__background:focus { + &-background:hover, &-background:focus { color: var(--linkColor); background-color: transparent; } } -.tagsData { +.tags-data { display: flex; flex-direction: column; flex-wrap: wrap; diff --git a/templates/404.html b/templates/404.html index 6279038..5d4281e 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "page.html" %} {% block content %}
@@ -6,6 +6,6 @@

not found

Yeah, sorry, it's just that boring old error. Not even a cool one like 418, or a scary one like 500. Just a plain, old, boring 404: The page you were trying to reach just doesn't seem to be there, so either the link is broken or you made a typo.

I suppose I shouldn't rule out the possibility that you had enough time on your hands that checking out the zaaarf.foo 404 page seemed like a productive use for it. If that's the case, I urge you to get a job or hobby ASAP.

-

If, however, you do have a legitimate reason for being here, I'd appreciate it if you took the time to notify whoever sent you here that the link is broken.

+

If, however, you do have a legitimate reason for being here, I'd appreciate it if you took the time to notify whoever sent you here that the link is broken. Cheers!

{% endblock content %} diff --git a/templates/base-page.html b/templates/base-page.html deleted file mode 100644 index e2d9a2a..0000000 --- a/templates/base-page.html +++ /dev/null @@ -1,15 +0,0 @@ -

{{ page.title }}

- -{% if page.toc and page.extra.toc %} - {% include "toc.html" %} -{% endif %} - -{{ page.content | safe }} - -

- {% if page.taxonomies.tags %} - {% for tag in page.taxonomies.tags %} - /{{ tag }}/ - {% endfor %} - {% endif %} -

diff --git a/templates/base.html b/templates/base.html deleted file mode 100644 index b3ed6ca..0000000 --- a/templates/base.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - {% include "head.html" %} - - -
-
- {% include "header.html" %} -
-
- {% block content %} - {% endblock content %} -
-
- {% include "footer.html" %} -
-
- - \ No newline at end of file diff --git a/templates/footer.html b/templates/footer.html deleted file mode 100644 index 684c0ed..0000000 --- a/templates/footer.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
-
-

Licensed under the MIT License.
- Built with Zola using the friendenstein theme.
-

-
- {% if config.generate_feed %} -
- -
- {% endif %} -
diff --git a/templates/head.html b/templates/head.html index a0b02ac..59d244d 100644 --- a/templates/head.html +++ b/templates/head.html @@ -1,99 +1,80 @@ +{% import "macros/marginals.html" as marginals %} {% if page.title %} -{% set title = page.title %} + {% set title = page.title %} {% elif section.title %} -{% set title = section.title %} + {% set title = section.title %} {% elif config.title %} -{% set title = config.title %} + {% set title = config.title %} {% endif %} {% if page.extra.author %} -{% set author = page.extra.author %} + {% set author = page.extra.author %} {% elif section.extra.author %} -{% set author = section.extra.author %} + {% set author = section.extra.author %} {% elif config.extra.author %} -{% set author = config.extra.author %} + {% set author = config.extra.author %} {% endif %} {% if page.description %} -{% set description = page.description | truncate(length=150) %} + {% set description = page.description | truncate(length=150) %} {% elif section.description %} -{% set description = section.description | truncate(length=150) %} + {% set description = section.description | truncate(length=150) %} {% elif config.description %} -{% set description = config.description | truncate(length=150) %} + {% set description = config.description | truncate(length=150) %} {% endif %} {% if page.extra.image %} -{% set image = get_url(path=page.extra.image, trailing_slash=false) %} + {% set image = get_url(path=page.extra.image, trailing_slash=false) %} {% elif section.extra.image %} -{% set image = get_url(path=section.extra.image, trailing_slash=false) %} + {% set image = get_url(path=section.extra.image, trailing_slash=false) %} {% elif config.extra.favicon %} -{% set image = get_url(path=config.extra.favicon, trailing_slash=false) %} + {% set image = get_url(path=config.extra.favicon, trailing_slash=false) %} {% endif %} {% if page.permalink %} -{% set url = page.permalink %} + {% set url = page.permalink %} {% elif section.permalink %} -{% set url = section.permalink %} + {% set url = section.permalink %} {% elif config.base_url %} -{% set url = config.base_url %} + {% set url = config.base_url %} {% endif %} {% if title %} -{% if title == config.title %} -{{ title }} :: Home -{% else %} -{{config.title }} :: {{ title }} -{% endif %} + {% if title == config.title %} + {{ title }} :: Home + {% else %} + {{config.title }} :: {{ title }} + {% endif %} {% endif %} {% block metatags %} {% if title %} - -{% endif %} -{% if author %} - + + + {% endif %} +{% if author %}{% endif %} {% if description %} - + + {% endif %} -{% if title %} - -{% endif %} -{% if title %} - -{% endif %} -{% if description %} - -{% endif %} -{% if image %} - -{% endif %} +{% if image %}{% endif %} {% set twitter_card = config.extra.twitter_card | default(value=true) %} {% if twitter_card != false %} - - -{% if title %} - -{% endif %} -{% if description %} - -{% endif %} -{% if image %} - -{% endif %} + + + {% if title %}{% endif %} + {% if description %}{% endif %} + {% if image %}{% endif %} {% endif %} -{% if image %} - -{% endif %} +{% if image %}{% endif %} {% endblock metatags %} -{% if config.generate_feed %} {% block feed %} - +{% if config.generate_feed %}{% endif %} {% endblock feed %} -{% endif %} {% block css %} {% if config.markdown.highlight_code and config.markdown.highlight_theme == "css" %} - + {% endif %} {% endblock css %} diff --git a/templates/header.html b/templates/header.html deleted file mode 100644 index 03ae13d..0000000 --- a/templates/header.html +++ /dev/null @@ -1,28 +0,0 @@ -{% set current_lang = config.default_language %} -{% if page %} - {% set current_lang = page.lang %} -{% elif section %} - {% set current_lang = section.lang %} -{% endif %} -{% if config.extra.header_nav %} - -{% endif %} diff --git a/templates/index.html b/templates/index.html index 2fc9292..31ca9e8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,5 +1,5 @@ {% import "macros/svg.html" as svg %} -{% extends "base.html" %} +{% extends "page.html" %} {% block content %}
diff --git a/templates/logo.html b/templates/logo.html deleted file mode 100644 index 6aeebe9..0000000 --- a/templates/logo.html +++ /dev/null @@ -1,29 +0,0 @@ - - - diff --git a/templates/macros/marginals.html b/templates/macros/marginals.html new file mode 100644 index 0000000..407e56a --- /dev/null +++ b/templates/macros/marginals.html @@ -0,0 +1,78 @@ +{% macro logo() %} + + + +{% endmacro logo %} + +{% macro navbar(current_lang) %} +{% if config.extra.header_nav %} + +{% endif %} +{% endmacro navbar %} + +{% macro footer() %} +
+
+
+

Licensed under the MIT License.
+ Built with Zola using the friendenstein theme.
+

+
+ {% if config.generate_feed %} +
+ +
+ {% endif %} +
+{% endmacro footer %} diff --git a/templates/toc.html b/templates/macros/post.html similarity index 63% rename from templates/toc.html rename to templates/macros/post.html index 8f3815c..e8772a2 100644 --- a/templates/toc.html +++ b/templates/macros/post.html @@ -1,7 +1,8 @@ +{% macro toc(toc) %}

Table of contents

    - {% for h1 in page.toc %} + {% for h1 in toc %}
  • {{ h1.title }} {% if h1.children %} @@ -24,3 +25,14 @@ {% endfor %}
+{% endmacro toc %} + +{% macro tags(tags) %} +

+ {% if page.taxonomies.tags %} + {% for tag in tags %} + /{{ tag }}/ + {% endfor %} + {% endif %} +

+{% endmacro tags %} diff --git a/templates/page.html b/templates/page.html index 38d0624..56928fc 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,5 +1,43 @@ -{% extends "base.html" %} +{% import "macros/marginals.html" as marginals %} +{% import "macros/post.html" as post %} + + + + {% include "head.html" %} + + +
+
+ {% set current_lang = config.default_language %} + {% if page %} + {% set current_lang = page.lang %} + {% elif section %} + {% set current_lang = section.lang %} + {% endif %} + {{ marginals::navbar(current_lang=current_lang) }} +
+
+ {% block pre_content %} + {% endblock pre_content %} +
+ {% block content %} +

{{ page.title }}

-{% block content %} -{% include "base-page.html" %} -{% endblock content %} + {% if page.toc and page.extra.toc %} + {{ post::toc(toc=page.toc) }} + {% endif %} + + {{ page.content | safe }} + + {% if page.taxonomies.tags %} + {{ post::tags(tags=page.taxonomies.tags) }} + {% endif %} + {% endblock content %} +
+
+
+ {{ marginals::footer() }} +
+
+ + diff --git a/templates/blog-page.html b/templates/post.html similarity index 81% rename from templates/blog-page.html rename to templates/post.html index 2c06d54..fd45705 100644 --- a/templates/blog-page.html +++ b/templates/post.html @@ -1,6 +1,6 @@ -{% extends "base.html" %} +{% extends "page.html" %} -{% block content %} +{% block pre_content %}
../
{% if config.extra.date_format.post %} {% set datefmt = config.extra.date_format.post %} @@ -11,7 +11,4 @@ {% if config.extra.author and config.extra.display_author == true %} {% endif %} - -
{% include "base-page.html" %}
- -{% endblock content %} +{% endblock pre_content %} diff --git a/templates/section.html b/templates/section.html index c19d3c1..70b2a47 100644 --- a/templates/section.html +++ b/templates/section.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "page.html" %} {% block content %}

{{ section.title }}

diff --git a/templates/tags/list.html b/templates/tags/list.html index 662769e..f196a99 100644 --- a/templates/tags/list.html +++ b/templates/tags/list.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "page.html" %} {% block content %}

{{ taxonomy.name }}

@@ -7,4 +7,4 @@ #{{ term.name }}[{{ term.pages | length }}] {% endfor %}

-{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/templates/tags/single.html b/templates/tags/single.html index e143303..bf6afb6 100644 --- a/templates/tags/single.html +++ b/templates/tags/single.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "page.html" %} {% block content %}

{{ term.name }}

@@ -17,4 +17,4 @@ {% if paginator %}

{% if paginator.previous %}<< First < Previous{% endif %} [{{ paginator.current_index }}/{{ paginator.number_pagers }}] {% if paginator.next %}Next > Last >>{% endif %}

{% endif %} -{% endblock content %} \ No newline at end of file +{% endblock content %}