mirror of
https://github.com/andwati/andwati.com.git
synced 2026-11-18 06:35:15 +00:00
Migrate templates to Zola 0.23 / Tera v2
bin/update-zola always installs the latest release, which as of
v0.23.0 rewrote the template engine to Tera v2. That broke the whole
site: removed filters (slice, concat, escape), test calls now require
named args, shortcodes are gone in favor of Tera components, and
content itself is now Tera-templated before markdown runs.
- slice(end=n) -> native [:n] slicing; concat(with=x) -> spread [...arr, x]
- escape -> escape_html; starting_with/containing -> named `pat` arg
- get_taxonomy_url `name` -> `term` (old name is deprecated)
- %+ date format no longer recognized; replaced with explicit RFC3339 pattern
- shortcodes (note/tip/warning/danger/youtube) rewritten as components;
content call sites updated to component invocation syntax
- {% include %} no longer inherits for-loop-local variables (only ambient
page/section context) - post-card.html converted to a component that
takes page/index explicitly instead of relying on implicit `page`/`loop`
- two content code blocks with literal Jinja-style {{ }} syntax (Netlify
CMS config, a Flask template snippet) wrapped in {% raw %} so Tera
doesn't try to render them, since content is now templated too
- fixed a real content corruption bug along the way: the youtube
shortcode's multi-line <iframe> tag had a conditional that could
collapse to a whitespace-only line, which prematurely closed the
HTML block under CommonMark rules and got the rest of the tag
syntax-highlighted as code instead of rendered
Verified with a clean `zola build` and `zola serve` on v0.23.1, plus a
spot-check of the rendered HTML for both callouts and the video embed.
`zola check` only reports pre-existing external link rot, unrelated to
this change.
This commit is contained in:
+8
-8
@@ -8,12 +8,12 @@
|
||||
{% block og_title %}{{ page.title }}{% endblock og_title %}
|
||||
{% block og_description %}{{ page.description | default(value=config.description) }}{% endblock og_description %}
|
||||
{% block og_url %}{{ page.permalink }}{% endblock og_url %}
|
||||
{% block og_type %}{% if page.ancestors is containing("posts/_index.md") %}article{% else %}website{% endif %}{% endblock og_type %}
|
||||
{% block og_type %}{% if "posts/_index.md" in page.ancestors %}article{% else %}website{% endif %}{% endblock og_type %}
|
||||
{% block og_image %}{{ config.base_url }}{{ page.extra.image | default(value="/images/og-image.png") }}{% endblock og_image %}
|
||||
{% block og_extra %}
|
||||
{% if page.ancestors is containing("posts/_index.md") %}
|
||||
{% if page.date %}<meta property="article:published_time" content="{{ page.date | date(format="%+") }}">{% endif %}
|
||||
{% if page.updated %}<meta property="article:modified_time" content="{{ page.updated | date(format="%+") }}">{% endif %}
|
||||
{% if "posts/_index.md" in page.ancestors %}
|
||||
{% if page.date %}<meta property="article:published_time" content="{{ page.date | date(format="%Y-%m-%dT%H:%M:%S%:z") }}">{% endif %}
|
||||
{% if page.updated %}<meta property="article:modified_time" content="{{ page.updated | date(format="%Y-%m-%dT%H:%M:%S%:z") }}">{% endif %}
|
||||
<meta property="article:author" content="{{ config.extra.author }}">
|
||||
{% if page.taxonomies.tags %}
|
||||
{% for tag in page.taxonomies.tags %}
|
||||
@@ -29,7 +29,7 @@
|
||||
{% block twitter_image %}{{ config.base_url }}{{ page.extra.image | default(value="/images/og-image.png") }}{% endblock twitter_image %}
|
||||
|
||||
{% block head %}
|
||||
{% if page.ancestors is containing("posts/_index.md") %}
|
||||
{% if "posts/_index.md" in page.ancestors %}
|
||||
<!-- SEO: BlogPosting JSON-LD -->
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
@@ -45,8 +45,8 @@
|
||||
"image": "{{ config.base_url | safe }}{% if page.extra.image %}{{ page.extra.image | safe }}{% else %}/images/og-image.png{% endif %}",
|
||||
"url": "{{ page.permalink | safe }}",
|
||||
"inLanguage": "en-US",
|
||||
{% if page.date %}"datePublished": "{{ page.date | date(format="%+") }}",{% endif %}
|
||||
{% if page.updated %}"dateModified": "{{ page.updated | date(format="%+") }}",{% else %}{% if page.date %}"dateModified": "{{ page.date | date(format="%+") }}",{% endif %}{% endif %}
|
||||
{% if page.date %}"datePublished": "{{ page.date | date(format="%Y-%m-%dT%H:%M:%S%:z") }}",{% endif %}
|
||||
{% if page.updated %}"dateModified": "{{ page.updated | date(format="%Y-%m-%dT%H:%M:%S%:z") }}",{% else %}{% if page.date %}"dateModified": "{{ page.date | date(format="%Y-%m-%dT%H:%M:%S%:z") }}",{% endif %}{% endif %}
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"@id": "{{ config.base_url | safe }}/#author",
|
||||
@@ -193,7 +193,7 @@
|
||||
<div class="post-tags">
|
||||
{% if page.taxonomies.tags %}
|
||||
{% for tag in page.taxonomies.tags %}
|
||||
<a href="{{ get_taxonomy_url(kind="tags", name=tag) }}" class="tag">#{{ tag }}</a>
|
||||
<a href="{{ get_taxonomy_url(kind="tags", term=tag) }}" class="tag">#{{ tag }}</a>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user