你好哇,Willow 是为静态站点生成工具 zola 制作的一款主题。没有 Tabler 这么漂亮的开源 UI 套件,以我丑陋的审美也没法做出好看的主题。感谢 Tabler 以及其他第三方库,感谢开源!
willow 的一些主要功能:
使用 willow 前先熟悉下 zola 的用法。
确保使用 zola init myblog
创建了项目,然后将 willow 克隆到本地 themes 文件下:
cd themes
git submodule add https://github.com/ischaojie/willow.git themes/willow
之后在 config.toml
文件中指定 theme 为 willow:
theme = "willow"
zola 支持在 extra
字段增加自定义的配置项,willow
的所有配置均以 extra.willow
开头,基础配置包括:
-
首页展示的文章数量
[extra.willow] show_article_num = 10
-
导航栏的顺序 目前支持的导航栏有:
articles
、tags
、about
、photography
、memos
。且home
默认为首位。Notice
注意增加对应导航的翻译:
[languages.zh-CN.translations] language_name = "中文" home = "首页" articles = "文章" tags = "标签" photography = "摄影" about = "关于" memos = "碎碎念"
[extra.willow] nav = ["articles", "tags", "about"]
-
Google Analytics
[extra.willow] google_analytics = "G-XXX"
Willow 目前支持的社交账号有:twitter
、douban
、github
(如有其他需求,欢迎 issue)。配置参考:
[extra.willow.social]
twitter = "chaojie_cn"
douban = "218724191"
github = "ischaojie"
所有配置项均为账号 id。
willow 目前仅支持 giscus 评论系统(如有其他需求,欢迎 issue)。首先参考 giscus 的文档,生成自己的 giscus 配置。然后在 config.toml
中增加对应的配置项:
[extra.willow.comment.giscus]
repo = "<>"
repo_id = "<>"
category = "<>"
category_id = "<>"
mapping = "<>"
memos 是一个轻量级的、自托管的备忘录(动态)中心。
参考官方文档搭建自己的 memos 服务,然后在 config.toml
中增加对应的配置项:
[extra.willow.memos]
# 每次加载展示的 memo 数量
show_num = 10
# API 接口
api = "https://momo.chaojie.fun/api/memo/all"
willow 支持摄影作品页面,您可以自定义或者使用其他平台(目前仅 unsplash)。配置参考:
[extra.willow.photography]
# 类型:使用 unsplash 中的照片,置空展示 photos 中的照片。
type = "unsplash"
# client id: 申请 unsplash 开发者账号,获取 client id
unsplash_client_id = "Nzn8Fo0oteghIaTz-B0AAH3GQ-7BH2XNqWiJpE1AsB8"
# 要展示的作者
unsplash_author = "chaojie"
photos = [
"https://file.chaojie.fun/photography/过春天.jpg",
"https://file.chaojie.fun/photography/lan.jpg",
]
# --- willow config example --- #
[extra.willow]
# The number of articles to show on the home page
show_article_num = 10
# The order of the navigation bar, home is the first by default
# current supported nav: articles, tags, about, photography, memos
nav = ["articles", "memos", "photography", "tags", "about"]
# --- social accounts --- #
# currently supported: twitter, douban, github
[extra.willow.social]
twitter = "chaojie_cn"
douban = "218724191"
github = "ischaojie"
# --- photography --- #
[extra.willow.photography]
# Put the photos you want to show on the photography page here
photos = [
"https://file.chaojie.fun/photography/过春天.jpg",
"https://file.chaojie.fun/photography/lan.jpg",
]
# --- giscus --- #
# see https://giscus.app/ for more details
[extra.willow.comment.giscus]
repo = "ischaojie/willow"
repo_id = "R_kgDOJSaQFQ"
category = "Announcements"
category_id = "DIC_kwDOJSaQFc4CVjI_"
mapping = "title"
# --- memos --- #
[extra.willow.memos]
show_num = 10
# The memo api
api = "https://momo.chaojie.fun/api/memo/all"
MIT