|
就像 domain.com/blog/2025/my-post 这样的格式。 |
Answered by
cworld1
Jan 26, 2025
Replies: 1 comment 2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


实现方案
[手动] blog 目录下建立 2024、2025 等文件夹,再在内部塞入对应文件。
从 content collection id 下手
a. [自动] 经测试在 define 文件中没有暴露 id,故的确不可行
b. [手动] 使用 custom ids 手动定义,但较为复杂麻烦
[自动] 使用 dynamic routes 双层匹配。具体说明见后文。
Dynamic routes
改写匹配规则 [...id].astro 为: