Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

做成一个完全可定制化的静态网站生成器 #9

Open
stdrc opened this issue Oct 1, 2022 · 0 comments
Open

做成一个完全可定制化的静态网站生成器 #9

stdrc opened this issue Oct 1, 2022 · 0 comments

Comments

@stdrc
Copy link
Member

stdrc commented Oct 1, 2022

可以对不同的文件夹,配置不同的加载+渲染策略,比如

  • 文件 /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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant