summaryrefslogtreecommitdiff
path: root/templates/components.html
diff options
context:
space:
mode:
authorMole Shang <135e2@135e2.dev>2026-09-02 15:49:49 +0800
committerMole Shang <135e2@135e2.dev>2026-09-02 15:49:49 +0800
commit23d62aaa39dae753d39dcd596b962ccc1c5cdb36 (patch)
tree269670883636ee9adb47a123acd69abd2d6522a0 /templates/components.html
parenta582b6ef76bfb79744716f5cdfafff8c41861ec9 (diff)
downloadSeje2-main.tar.gz
Seje2-main.tar.bz2
Seje2-main.zip
templates: migrate to zola 0.23main
tera v1->v2 https://github.com/getzola/zola/issues/3235 https://github.com/Keats/tera/blob/master/MIGRATION.md
Diffstat (limited to 'templates/components.html')
-rw-r--r--templates/components.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/templates/components.html b/templates/components.html
new file mode 100644
index 0000000..5e07ac0
--- /dev/null
+++ b/templates/components.html
@@ -0,0 +1,61 @@
+{% component format_chinese_date(year, month, day) %}
+{% set lut1 = ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"] %}
+{% set lut2 = [
+ '一', '二', '三', '四',
+ '五', '六', '七', '八',
+ '九', '十', '十一', '十二',
+ '十三', '十四', '十五', '十六',
+ '十七', '十八', '十九', '二十',
+ '廿一', '廿二', '廿三', '廿四',
+ '廿五', '廿六', '廿七', '廿八',
+ '廿九', '三十', '三十一'] %}
+{% for c in year | str %}{{ lut1 | nth(n=c | int) }}{% endfor %}年{{ lut2 | nth(n=month-1)}}月{{ lut2 | nth(n=day-1) }}日
+{% endcomponent format_chinese_date %}
+
+{% component post_meta(post, chinese_date, expand) %}
+<div class="post-meta" {% if expand %}style="text-align: end"{% endif %}>
+ {% if expand %}<div>{% else %}<span>{% endif %}
+ {% for author in post.authors %}
+ {{ author }}
+ {% endfor %}
+ {% if expand %}</div>{% else %}</span>{% endif %}
+ {% if expand %}<div>{% else %}<span class="divider">{% endif %}
+ {% if chinese_date %}
+ {{ <format_chinese_date year={post.year} month={post.month} day={post.day} /> }}
+ {% else %}
+ {{ post.date|date(format="%Y/%m/%d") }}
+ {% endif %}
+ {% if expand %}</div>{% else %}</span>{% endif %}
+ {% if expand %}<div>{% else %}<span class="divider">{% endif %}
+ {% if post.taxonomies.tags %}
+ {% for tag in post.taxonomies.tags %}
+ <span class="tag"><a href="{{ get_taxonomy_url(kind="tags", name=tag) | safe }}">#{{ tag }}</a></span>
+ {% endfor %}
+ {% endif %}
+ {% if expand %}</div>{% else %}</span>{% endif %}
+</div>
+{% endcomponent post_meta %}
+
+{% component shikwasa(subtitle, author, image, media) %}
+<link
+ rel="stylesheet"
+ href="https://cdn.jsdelivr.net/npm/shikwasa@2.2.0/dist/style.css"
+/>
+<script src="https://cdn.jsdelivr.net/npm/shikwasa@2.2.0/dist/shikwasa.min.js"></script>
+<div class="podcast">
+ <script>
+ const player = new Shikwasa.Player({
+ container: () => document.querySelector(".podcast"),
+ audio: {
+ title: "{{subtitle}}",
+ artist: "{{author}}",
+ cover: "{{image | safe}}",
+ src: "{{media | safe}}",
+ },
+ fixed: {
+ type: "static",
+ },
+ });
+ </script>
+</div>
+{% endcomponent shikwasa %}