いまのところ、即席のテンプレートを使っているので、このまま公開するのは耐えない感じ。公開済みのいいテンプレートはないだろうか?

Zola公式にテーマ一覧があるらしい。いっぱいありすぎ。
Zola Themes(公式ギャラリー)
https://www.getzola.org/themes/
Andromedaがいいかな。写真日記・フォトジャーナル用みたいだけど、写真もほどほど入っているからいいかも。ライセンスはMIT。
Andromeda | Zola
https://www.getzola.org/themes/andromeda/
入れてみる。
% cd themes
% git clone https://github.com/Pixadus/andromeda-theme themes/andromeda
Cloning into 'themes/andromeda'...
remote: Enumerating objects: 260, done.
remote: Counting objects: 100% (260/260), done.
remote: Compressing objects: 100% (184/184), done.
remote: Total 260 (delta 129), reused 192 (delta 68), pack-reused 0 (from 0)
Receiving objects: 100% (260/260), 15.47 MiB | 8.69 MiB/s, done.
Resolving deltas: 100% (129/129), done.
zola serveでは、テーマの変更は反映されない感じ。テンプレートが邪魔しているのかな?
% cd ../templates
% mv index.html index.html.org
% mv page.html page.html.org
なるほど、themes/andromeda/config.tomlをコピーする必要があるのね。
% cd ..
% mv config.toml config.toml.org
うう、コピペでcloneするとthemesができちゃうじゃないの。
% cd themes
% ls
themes
cloneからやりなおし。
% cd ..
% rm -rf themes/themes
% ls themes
andromeda
% cp themes/andromeda/config.toml ./
serveは、設定の変更を検知するけど、なにも表示がかわらない。
Change detected @ 2025-11-24 11:29:50
-> Config changed. The browser needs to be refreshed to make the changes visible.
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 1 pages (0 orphan) and 0 sections
Done in 10ms.
まだなんかしないといけないのかな? 設定をチェックする。
% cat config.toml
# Site title
title = "Andromeda"
base_url = "https://andromeda-theme.netlify.app"
description = "Photography journal theme for Zola"
compile_sass = true
[extra]
header_links = [
{name = "Zola", url = "https://www.getzola.org/"},
{name = "Blog", url = "https://andromeda-theme.netlify.app"}
]
license = "CC BY-NC 2.0"
email = "jane@doe.com"
name = "Jane Doe"
# favicon = "/images/favicon.ico"
あぁ、基本設定とかも押し着せせなのね。書き換える。
config.tomlを書き換えたら、serveでエラー出ているよ。いやぁ、andromedaの指示通りにしただけなんだけど。
Change detected @ 2025-11-24 11:37:20
-> Config changed. The browser needs to be refreshed to make the changes visible.
Error: Failed to build the site
Error: TOML parse error at line 22, column 9
|
22 | theme = andromeda
| ^
invalid string
expected `"`, `'`
Done in 3ms.
こんな感じに。
% cat config.toml
# The URL the site will be built for
base_url = "https://example.com"
# Whether to automatically compile all Sass files in the sass directory
compile_sass = true
# Whether to build a search index to be used later on by a JavaScript library
build_search_index = false
[markdown]
# Whether to do syntax highlighting
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
highlight_code = true
[extra]
# Put all your custom variables here
title = "kinneko's fanbox blog"
description = "FANBOXで書いているブログの退避場所"
# favicon = "/images/favicon.ico"
email = "kinneko@gmail.com"
name = "kinneko"
theme = "andromeda"
表示は「Welcome to Zola!」のままだな... テンプレートは必要なのかな?
どうやら、themeはトップレベルにないとダメらしい。全部extraからbase_urlの下に移動してみると、エラーになった。
Change detected @ 2025-11-24 11:47:21
-> Config changed. The browser needs to be refreshed to make the changes visible.
Error: Failed to build the site
Error: TOML parse error at line 7, column 1
|
7 | email = "kinneko@gmail.com"
| ^^^^^
unknown field `email`, expected one of `base_url`, `theme`, `title`, `description`, `default_language`, `languages`, `translations`, `generate_feeds`, `feed_limit`, `feed_filenames`, `hard_link_static`, `taxonomies`, `author`, `compile_sass`, `minify_html`, `build_search_index`, `ignored_content`, `ignored_static`, `mode`, `output_dir`, `preserve_dotfiles_in_output`, `link_checker`, `slugify`, `search`, `markdown`, `extra`, `generate_sitemap`, `generate_robots_txt`, `exclude_paginated_pages_in_sitemap`
emailとnameを[extra]に戻す。
別のエラー。
Change detected @ 2025-11-24 11:48:25
-> Config changed. The browser needs to be refreshed to make the changes visible.
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 1 pages (0 orphan) and 0 sections
Error: Failed to build the site
Error: Failed to render page '/Users/kinneko/Documents/fanbox-zola/content/2025-01-01.md'
Error: Reason: Failed to render 'page.html'
Error: Reason: Variable `page.extra.header_img` not found in context while rendering 'page.html'
Done in 25ms.
なるほど、Andromedaのpage.htmlテンプレートがpage.extra.header_imgという変数が必ずある前提で書かれているので、レンダリングできないとな。
templatesにfanbox用のヘッダ画像を入れてコンテンツにheader_imgを追記してみる。
% ls templates
3D_Printing.jpg ESP32.png Things.jpg index.html.org
AWS.jpg Pi.jpg event.png page.html.org
% vi content/2025-01-01.md
[extra]
header_img = "/templates/event.png"
またエラー。
Change detected @ 2025-11-24 11:53:22
-> Content changed /Users/kinneko/Documents/fanbox-zola/content/2025-01-01.md
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 1 pages (0 orphan) and 0 sections
Error: Failed to build the site
Error: Failed to render pager 1
Error: Reason: Failed to render 'index.html'
Error: Reason: Variable `config.extra.header_links` not found in context while rendering 'section.html'
Done in 10ms.
config.tomlにheader_linksがいるそうな。それっぽい感じのを書く。
% vi config.toml
[extra]
# ナビゲーションバーに出すリンク
header_links = [
{ title = "Home", url = "/" },
]
またエラー。
% zola serve
Building site...
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 1 pages (0 orphan) and 0 sections
Error: Failed to serve the site
Error: Failed to render pager 1
Error: Reason: Failed to render 'index.html'
Error: Reason: Variable `link.name` not found in context while rendering 'section.html'
適当に書いたのはダメらしいw title -> name に変更
% vi config.toml
# ナビゲーションバーに出すリンク
header_links = [
{ name = "Home", url = "/" },
# { name = "About", url = "/about/" },
]
これでようやく表示が出たのだけど、コンテンツがない感じになっている。

コンテンツの中にdescriptionが必須なのね。
% vi content/2025-01-01.md
+++
title = "はじめての投稿"
date = 2025-01-01
description = "FANBOX移行テスト用の最初の投稿"
[extra]
header_img = "/event.png"
+++
記事の本文。
画像は、staticの下に入れると参照できる感じ。
% mv templates/*.jpg templates/*.png static
% ls static
3D_Printing.jpg ESP32.png Things.jpg
AWS.jpg Pi.jpg event.png
まだ表示されないな。
これかな? 違うな...
% mv content/_index.md content/_index.md.org
これかな? 違うな...
% mv content/2025-01-01.md content/blog2025-01-01.md
うーん、テンプレ通りの作ってみるか。
% vi content/test-post.md
+++
title = "テスト投稿"
date = 2024-01-01
description = "Andromeda テーマのテスト投稿です"
extra = { header_img = "/header.jpg" }
+++
これはテスト投稿です。
あ、なんか出た。



一回出ると、ダミーで作ったのを削除しても出るな。

どうやら原因は、serveでのレンダリングが、再起動しないと発動しないことのようだ。
コンテンツページのヘッダに「draft = true」を書いておくと、一覧表示から除外されるようだ。
あと、faviconつけるなら、tomlにこれも書いておくといいのかも。
# favicon_mimetype = "image/x-icon"
オリジナル投稿: Zola使ってみる -2-|kinneko|pixivFANBOX
https://www.fanbox.cc/@kinneko/posts/10936355



