Merge pull request 'Upgrade to latest zola & Tera 2' (#41) from adidalal/zola-bearblog:tera-v2 into main Reviewed-on: https://codeberg.org/alinnow/zola-bearblog/pulls/41
21 files changed, 80 insertions(+), 88 deletions(-)
changed files
- .forgejo/workflows/zola.yaml
- .gitlab-ci.yml
- README.md
- config.toml
- flake.lock
- netlify.toml
- templates/base.html
- templates/components/toc.html
- templates/custom_body.html
- templates/custom_head.html
- templates/favicon.html
- templates/footer.html
- templates/language_switcher.html
- templates/nav.html
- templates/page.html
- templates/section.html
- templates/seo_tags.html
- templates/taxonomy_list.html
- templates/taxonomy_single.html
- theme.toml
M .forgejo/workflows/zola.yaml → .forgejo/workflows/zola.yaml
@@ -1,7 +1,7 @@ name: Deploy Zola site to Pages env: - ZOLA_VERSION: 0.21.0 + ZOLA_VERSION: 0.23.4 # This workflow will only work correctly in https://codeberg.org/alinnow/zola-bearblog.git. # Adjust the site name to match your user and repository name. To publish # to the index site, https://username.codeberg.page/, name your repository `pages`.@@ -21,12 +21,12 @@ publish: # You can find the list of available runners on https://codeberg.org/actions/meta, or run one yourself. runs-on: codeberg-tiny-lazy container: - image: "alpine:3.23" + image: "alpine:edge" steps: - name: Install CI prerequisites run: | apk upgrade -Ua - apk add nodejs git 'zola=~${{ env.ZOLA_VERSION }}' + apk add nodejs git "zola=~${ZOLA_VERSION%.*}" - name: Clone the repository uses: https://code.forgejo.org/actions/checkout@v5 with:
M .gitlab-ci.yml → .gitlab-ci.yml
@@ -14,7 +14,7 @@ # Use the semver format (x.y.z) to specify a version. # For example: "0.17.2" or "0.18.0". ZOLA_VERSION: description: "The version of Zola used to build the site." - value: "0.21.0" + value: "0.23.4" pages: stage: deploy
M README.md → README.md
@@ -12,23 +12,17 @@ ## Demo This theme has multiple demo sites, to provide examples of how to set up deployment. -### Recommended - - [Netlify](https://zola-bearblog.netlify.app/) - [Grebedoc](https://alanpearce.grebedoc.dev/zola-bearblog/) - [Codeberg Pages](https://alinnow.codeberg.page/zola-bearblog/) - [Gitlab Pages](https://alinnow.gitlab.io/zola-bearblog) - -### Not recommended - -These providers' build environments aren't yet compatible with Zola 0.21.0. -- [Cloudflare Pages](https://zola-bearblog.pages.dev/) +- [Cloudflare Pages](https://zola-bearblog.pages.dev/) - Use Build system Version 3 and set the variable `ZOLA_VERSION` ([documentation](https://developers.cloudflare.com/pages/configuration/build-image/)) ## Screenshot ![Screenshot][screenshot] -When the user's browser is running »dark mode«, the dark color scheme will be used automatically. The default is the light/white color scheme. Check out the [`style.html`](https://codeberg.org/alinnow/zola-bearblog/src/branch/main/templates/style.html)-file for the implementation. +When the user's browser is running »dark mode«, the dark color scheme will be used automatically. The default is the light/white color scheme. Check out the [`style.css.html`](https://codeberg.org/alinnow/zola-bearblog/src/branch/main/templates/style.css.html)-file for the implementation. ## Installation@@ -85,7 +79,7 @@ ### Adding your branding / colors / css -Add a `custom_head.html`-file to your `templates/`-directory. In there you may add a `<style>`-tag, *or* you may add a `<link>`-tag referencing your own `custom.css` (in case you prefer to have a separate `.css`-file). Check out the [`style.html`](https://codeberg.org/alinnow/zola-bearblog/src/branch/main/templates/style.css.html)-file to find out which CSS-styles are applied by default. +Add a `custom_head.html`-file to your `templates/`-directory. In there you may add a `<style>`-tag, *or* you may add a `<link>`-tag referencing your own `custom.css` (in case you prefer to have a separate `.css`-file). Check out the [`style.css.html`](https://codeberg.org/alinnow/zola-bearblog/src/branch/main/templates/style.css.html)-file to find out which CSS-styles are applied by default. ### Table of contents
M config.toml → config.toml
@@ -44,10 +44,11 @@ table_of_contents = "Inhaltsverzeichnis" language = "Sprache" site = "Site" -[markdown] -# Whether to do syntax highlighting -# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola -highlight_code = false + +# syntax highlighting is disabled by default +# as of Zola 0.23. uncomment the block below to enable +# [markdown.highlighting] +# theme = "gruvbox-dark" [extra] date_format = "%Y-%m-%d"
M flake.lock → flake.lock
@@ -20,11 +20,11 @@ } }, "nixpkgs": { "locked": { - "lastModified": 1754278406, - "narHash": "sha256-jvIQTMN5EzoOP5RaGztpVese8a3wqy0M/h6tNzycW28=", + "lastModified": 1788431191, + "narHash": "sha256-MFClkboDeW56feBCAeAV3Z3J2quGSZFlAOXQ4JjIlIA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6a489c9482ca676ce23c0bcd7f2e1795383325fa", + "rev": "9b9402b959a2276982ddd5ad3652a38b97f7c40b", "type": "github" }, "original": {
M netlify.toml → netlify.toml
@@ -4,7 +4,7 @@ command = "zola build" [build.environment] # Set the version name that you want to use and Netlify will automatically use it. -ZOLA_VERSION = "0.21.0" +ZOLA_VERSION = "0.23.4" [[headers]] for = "/*"
M templates/base.html → templates/base.html
@@ -1,31 +1,31 @@ <!DOCTYPE html> -<html lang="{{ lang | default(value="en-US" ) }}"> +<html lang="{{ lang or config.default_language or "en" }}"> <head> - {%- if config.webserver_sends_csp_headers %} - {%- include "security_tags.html" ignore missing %} + {%- if config.extra?.webserver_sends_csp_headers %} + {%- include "security_tags.html" %} {%- endif %} <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - {% include "favicon.html" ignore missing -%} + {% include "favicon.html" -%} <title>{%- block title %}{{ config.title }}{%- endblock %}</title> - {% include "seo_tags.html" ignore missing -%} + {% include "seo_tags.html" -%} <meta name="referrer" content="strict-origin-when-cross-origin"> + {% block rss -%} {%- if config.generate_feeds %} - {% block rss -%} {%- for feed_filename in config.feed_filenames %} <link rel="alternate" type={% if feed_filename == "atom.xml" %}"application/atom+xml"{% else %}"application/rss+xml"{% endif %} title="{{ config.title }}" href="{{ get_url(path=feed_filename) | safe }}"> {%- endfor -%} - {%- endblock -%} {%- endif %} + {%- endblock -%} <style> - {% include "style.css.html" ignore missing %} + {% include "style.css.html" %} </style> - {%- include "custom_head.html" ignore missing %} + {%- include "custom_head.html" %} </head> <body> - {% include "header.html" ignore missing %} + {%- include "header.html" %} {%- block main -%}{%- endblock -%} - {%- include "footer.html" ignore missing -%} - {%- include "custom_body.html" ignore missing -%} + {%- include "footer.html" -%} + {%- include "custom_body.html" -%} </body> </html>
A templates/components/toc.html
@@ -0,0 +1,12 @@ +{% component table_of_contents(toc: array, max_level: integer = 6, ...rest) {"doc": "Renders table of contents recursively"} %} +<ul> + {%- for header in toc %} + <li> + <a href="{{ header.permalink | safe }}">{{ header.title }}</a> + {%- if header.children and header.level < max_level %} + {{ <table_of_contents toc={header.children} max_level={max_level} /> }} + {%- endif %} + </li> + {%- endfor %} +</ul> +{% endcomponent table_of_contents %}
M templates/favicon.html → templates/favicon.html
@@ -1,3 +1,3 @@ -{% if config.extra.favicon %} - <link rel="shortcut icon" href="{{ config.extra.favicon }}"> +{% if config.extra?.favicon %} + <link rel="shortcut icon" href="{{ config.extra?.favicon }}"> {%- endif -%}
M templates/language_switcher.html → templates/language_switcher.html
@@ -1,7 +1,7 @@ -{%- if config.extra.language_switcher %} +{%- if config.extra?.language_switcher %} <nav class="lang" aria-label="{{ trans(key="language", lang=lang) }}"> - {%- set language_agnostic_path = current_path | default(value="/") | replace(from='/' ~ lang ~ '/', to = '/') | trim_start_matches(pat = '/') %} - {%- for tr in config.extra.translations %} + {%- set language_agnostic_path = (current_path or "/") | replace(from='/' ~ lang ~ '/', to = '/') | trim_start(pat = '/') %} + {%- for tr in config.extra?.translations %} {%- if tr.code == lang %} <span class="active">{{ tr.name }}</span> {%- else %}
D templates/macros.html
@@ -1,12 +0,0 @@ -{%- macro table_of_contents(toc, max_level) %} -<ul> - {%- for header in toc %} - <li> - <a href="{{ header.permalink | safe }}">{{ header.title }}</a> - {%- if header.children and header.level < max_level %} - {{- self::table_of_contents(toc=header.children, max_level=max_level) | indent() | safe() }} - {%- endif %} - </li> - {%- endfor %} -</ul> -{%- endmacro %}
M templates/page.html → templates/page.html
@@ -1,25 +1,25 @@ -{% import "macros.html" as macros %} + {% extends "base.html" %} {% block title %}{{ page.title }} | {{ super() }}{% endblock %} -{% block main %} - {%- if not page.extra.menu -%} +{%- block main -%} + {%- if not page.extra?.menu -%} <h1>{{ page.title }}</h1> {%- if page.date %} <p> <i> - <time datetime="{{ page.date | date(format='%+') }}" pubdate> - {{- page.date | date(format=config.extra.date_format) -}} + <time datetime="{{ page.date | date(format='%Y-%m-%d') }}" pubdate> + {{- page.date | date(format=config.extra?.date_format or "%Y-%m-%d") -}} </time> </i> </p> {%- endif %} {%- endif %} - {%- if config.extra.table_of_contents.show and not page.extra.hide_table_of_contents and page.toc %} - <details {% if config.extra.table_of_contents.visible_on_load %}open{% endif %}> + {%- if config.extra?.table_of_contents?.show and not page.extra?.hide_table_of_contents and page.toc %} + <details {% if config.extra?.table_of_contents?.visible_on_load %}open{% endif %}> <summary>{{ trans(key="table_of_contents", lang=lang) }}</summary> - {{- macros::table_of_contents(toc=page.toc, max_level=config.extra.table_of_contents.max_level) | indent() | safe() }} + {{ <table_of_contents toc={page.toc} max_level={config.extra?.table_of_contents?.max_level or 6} /> }} </details> {%- endif %} <main>@@ -30,9 +30,9 @@ {%- if page.taxonomies %} {%- for name, taxon in page.taxonomies %} {{ name | capitalize }}: {%- for item in taxon %} - <a href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">#{{ item }}</a> + <a href="{{ get_taxonomy_url(kind=name, term=item, lang=lang) }}">#{{ item }}</a> {%- endfor %} {%- endfor %} {%- endif %} </p> -{% endblock %} +{%- endblock main -%}
M templates/section.html → templates/section.html
@@ -2,7 +2,7 @@ {% extends "base.html" %} {%- block main -%} <main> - {%- if taxonomy.term %} + {%- if taxonomy?.term %} <h3 class="filter">{{ trans(key="filtering_for",lang=lang)}} "{{ section.title }}"</h3> <small> <a href="{{ get_url(path="@/blog/_index.md", lang=lang) }}">{{ trans(key="remove_filter", lang=lang) }}</a>@@ -13,8 +13,8 @@ {%- for page in section.pages %} <li> <span> <i> - <time datetime="{{ page.date | date(format='%+') }}" pubdate> - {{ page.date | date(format=config.extra.date_format) }} + <time datetime="{{ page.date | date(format='%Y-%m-%d') }}" pubdate> + {{ page.date | date(format=config.extra?.date_format or "%Y-%m-%d") }} </time> </i> </span>@@ -25,11 +25,11 @@ <li>{{ trans(key="no_posts", lang=lang) }}</li> {%- endfor -%} </ul> <div class="tags"> - {%- set taxonomy_group = section.extra.taxonomy_group | default(value="tags") %} + {%- set taxonomy_group = section.extra?.taxonomy_group or "tags" %} {%- set tags = get_taxonomy(kind=taxonomy_group, lang=lang) %} - {%- for post in tags.items %} + {%- for post in tags?.items or [] %} <a href="{{ post.permalink }}">#{{ post.name }}</a> {%- endfor %} </div> </main> -{% endblock %} +{%- endblock main -%}
M templates/taxonomy_list.html → templates/taxonomy_list.html
@@ -1,13 +1,13 @@ {% extends "base.html" %} -{% block main %} +{%- block main -%} <main> <h1>{{ taxonomy.name | capitalize }}</h1> <div class="tags"> - {%- set tags = get_taxonomy(kind="tags", lang=lang) %} - {%- for post in tags.items %} + {%- set tags = get_taxonomy(kind=taxonomy?.name or "tags", lang=lang) %} + {%- for post in tags?.items or [] %} <a href="{{ post.permalink }}">#{{ post.name }}</a> {%- endfor %} </div> </main> -{% endblock %} +{%- endblock main -%}
M templates/taxonomy_single.html → templates/taxonomy_single.html
@@ -2,7 +2,7 @@ {% extends "base.html" %} {%- block main -%} <main> - {%- if term %} + {%- if term?.name %} <h3 class="filter">{{ trans(key="filtering_for", lang=lang) }} "{{ term.name }}"</h3> <small> <a href="{{ get_url(path="@/blog/_index.md", lang=lang) }}">{{ trans(key="remove_filter", lang=lang) }}</a>@@ -13,8 +13,8 @@ {%- for page in term.pages %} <li> <span> <i> - <time datetime="{{ page.date | date(format='%+') }}" pubdate> - {{ page.date | date(format=config.extra.date_format) }} + <time datetime="{{ page.date | date(format='%Y-%m-%d') }}" pubdate> + {{ page.date | date(format=config.extra?.date_format or "%Y-%m-%d") }} </time> </i> </span>@@ -27,4 +27,4 @@ </li> {%- endfor %} </ul> </main> -{%- endblock -%} +{%- endblock main -%}
M theme.toml → theme.toml
@@ -3,7 +3,7 @@ description = "Bear blog theme" license = "MIT" homepage = "https://codeberg.org/alinnow/zola-bearblog" # The minimum version of Zola required -min_version = "0.4.0" +min_version = "0.23.0" # An optional live demo URL demo = "https://alinnow.codeberg.page/zola-bearblog/"