purepress
purepress copied to clipboard
做成一个完全可定制化的静态网站生成器
可以对不同的文件夹,配置不同的加载+渲染策略,比如
- 文件
/posts/2022-10-01-post-title.md
渲染为/post/2022/10/01/post-title/
,并将/
作为文章列表页面 - 文件
/pages/foo/bar.md
渲染为/foo/bar.html
- 文件
/photos/cat.md
渲染为/photos/cat.html
,并将/photos/
作为照片列表页面 - 文件
/docs/foo/bar.md
渲染为/docs/foo/bar.html
,并可以通过读取config.toml
来控制导航栏渲染等
具体的配置类似这样:
[[config.page_groups]]
title = "Posts"
path = "/posts/"
strategy = "posts"
index_url = "/"
index_template = "post-list"
detail_url = "/post/"
detail_template = "post-detail"
[[config.page_groups]]
path = "/pages/"
strategy = "custom-pages"
detail_url = "/"
detail_template = "page"
[[config.page_groups]]
title = "Photos"
path = "/photos/"
strategy = "gallery"
index_url = "/photos/"
index_template = "gallery-list"
detail_url = "/photos/"
detail_template = "gallery-detail"