Compare commits

...

6 commits

Author SHA1 Message Date
39a27ece37 Add last update time to article view
Would be nice to add it to the article list, do not know how to yet.
2021-05-22 23:25:37 +01:00
781e739e07 Removed unnecessary trailing slash for menu items 2020-10-03 01:05:58 +02:00
242a276c92 Added themed 404 page
Currently requires a hacky fix of the index.html template as the
404 only has the config in its context.
2020-10-03 00:09:39 +02:00
cb55cd17d1 Shrink hero banner 2020-10-02 23:03:35 +02:00
ac5828cde4 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
2020-10-02 21:12:24 +02:00
16730e8b46 Update feed generation to match Zola update 2020-10-02 21:12:18 +02:00
6 changed files with 101 additions and 12 deletions

View file

@ -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.

View file

@ -153,4 +153,4 @@
.hero-body
flex-grow: 1
flex-shrink: 0
padding: 3rem 1.5rem
padding: 1.5rem

28
templates/404.html Normal file
View file

@ -0,0 +1,28 @@
{% extends "index.html" %}
{% import "post_macros.html" as post_macros %}
{% block content %}
<!-- START NAV -->
{% block header %}
{{ super() }}
{% endblock header %}
<!-- END NAV -->
<main>
<section class="container">
<div class="columns is-desktop">
<div class="column is-10-desktop is-offset-1-desktop">
<article itemscope itemtype="http://schema.org/BlogPosting">
<div class="card article">
<div class="card-content">
<div itemprop="articleBody" class="content article-body">
<h1>404!</h1>
This page could not be found, perhaps it is not available in the current language or simply does not exist.
</div>
</div>
</div>
</article>
</div>
</div>
</section>
</main>
{% endblock content %}

View file

@ -25,8 +25,8 @@
</script>
{% endif %}
{% if config.generate_rss %}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") | safe }}">
{% if config.generate_feed %}
<link rel="alternate" type="application/atom+xml" title="RSS" href="{{ get_url(path="atom.xml") | safe }}">
{% endif %}
{% if config.build_search_index %}

View file

@ -53,12 +53,28 @@
{% 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 %}
<header>
<nav class="navbar">
<div class="container">
<div class="navbar-brand">
{% if config.extra.zulma_brand %}
{% if config.default_language is matching(lang) %}
<a class="navbar-item" href="/">
{% else %}
<a class="navbar-item" href="{{"/" ~ lang ~ "/"}}">
{% endif %}
{% if config.extra.zulma_brand.image %}
<img src="{{ config.extra.zulma_brand.image | safe | replace(from="$BASE_URL", to=config.base_url) }}"
alt="{{ config.extra.zulma_brand.text }}">
@ -77,11 +93,16 @@
<div class="navbar-end">
{% if config.extra.zulma_menu %}
{% for item in config.extra.zulma_menu %}
{% set item_url = item.url | replace(from="$BASE_URL", to=config.base_url) %}
{% set item_url = item_url ~ "/" %}
{% if config.default_language is matching(lang) %}
{% set item_url = item.url | replace(from="$BASE_URL", to=config.base_url) %}
{% else %}
{% set item_url = item.url | replace(from="$BASE_URL", to=config.base_url ~ "/" ~ lang) %}
{% endif %}
<a itemprop="url"
class="navbar-item {% if item_url == current_url %}is-active{% endif %}"
href="{{ item.url | safe | replace(from="$BASE_URL", to=config.base_url) }}">
href="{{ item_url }}">
<span itemprop="name">{{ item.name }}
</span>
</a>
@ -97,6 +118,36 @@
</div>
</div>
{% 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) %}
<a itemprop="url"
class="navbar-item {% if lang_url == current_url %}is-active{% endif %}"
href="{{ lang_url }}">
<span itemprop="name">{{ config.default_language }}
</span>
</a>
{% 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 %}
<a itemprop="url"
class="navbar-item {% if lang_url == current_url %}is-active{% endif %}"
href="{{ lang_url }}">
<span itemprop="name">{{ lang_code }}
</span>
</a>
{% endif %}
{% endfor %}
{% endif %}
</div>
</div>
</div>

View file

@ -15,7 +15,15 @@
</p>
</a>
<div class="tags has-addons level-item">
<span class="tag is-rounded">{{ page.date | date(format="%F") }}</span>
{% if page.updated %}
{% set latest_date = page.updated -%}
{% else %}
{% set latest_date = page.date -%}
{% endif %}
{% if latest_date %}
<span class="tag is-rounded">{{ latest_date | date(format="%F") }}</span>
{% endif %}
{% if page.taxonomies.authors %}
<span class="tag is-rounded is-primary">
{% for author in page.taxonomies.authors %}
@ -64,7 +72,7 @@
<div class="columns is-multiline">
<div class="column is-12">
<p>
Published
First published on
{{self::post_footer_date(page=page)}}
{{self::post_footer_authors(page=page)}}
{{self::post_footer_categories(page=page)}}
@ -93,7 +101,7 @@
{% if page.taxonomies.authors %}
by
{% for author in page.taxonomies.authors %}
<a href="{{ get_taxonomy_url(kind="authors", name=author) | safe }}">
<a href="{{ get_taxonomy_url(kind="authors", name=author, lang=page.lang) | safe }}">
<span class="tag is-primary">{{ author }} </span>
</a>
{% if page.taxonomies.authors | length > 1 %}
@ -113,7 +121,7 @@ and
{% macro post_footer_categories(page) %}
{% if page.taxonomies.categories %}
{% set category = page.taxonomies.categories[0] %}
in <a href="{{ get_taxonomy_url(kind="categories", name=category) | safe }}">
in <a href="{{ get_taxonomy_url(kind="categories", name=category, lang=page.lang) | safe }}">
<span class="tag is-success">
{{ category }}
</span>
@ -126,7 +134,7 @@ in <a href="{{ get_taxonomy_url(kind="categories", name=category) | safe }}">
{% if page.taxonomies.tags %}
and tagged
{% for tag in page.taxonomies.tags %}
<a href="{{ get_taxonomy_url(kind="tags", name=tag) | safe }}">
<a href="{{ get_taxonomy_url(kind="tags", name=tag, lang=page.lang) | safe }}">
<span class="tag is-link">{{ tag }} </span>
</a>
{% if page.taxonomies.tags | length > 1 %}
@ -140,4 +148,4 @@ and
{% endif %}
{% endfor %}
{% endif %}
{% endmacro post_footer_tags %}
{% endmacro post_footer_tags %}