Mar*_*Dee 5 go static-site hugo
我在Hugo中遵循了这个教程并且工作正常.基本上我有以下内容:
- content
`- post
`- coding
`- html
`- my-post.md
Run Code Online (Sandbox Code Playgroud)
和我的配置文件设置为
[permalinks]
post = "/:year/:month/:title/"
Run Code Online (Sandbox Code Playgroud)
它给了我URL
http://example.com/2016/12/my-post/
Run Code Online (Sandbox Code Playgroud)
我想要的是让读者根据日期或年份查看帖子列表.例如,如果他们访问,http://example.com/2016/12/他们将看到12月发布的帖子列表.如果他们访问,http://example.com/2016/他们将看到2016年发布的帖子列表.
在雨果有什么办法吗?
最简单的方法是在 Hugo 论坛上找到的,答案是每年使用分类法。每个帖子都需要放入当年的分类法中,并使用自定义列表模板来生成页面。这将允许 Hugo 为每个“年”(分类法)创建一个索引页,其中条目是“月”。这是一种创造性的解决方案,尽管比人们想象的要麻烦一些。
https://discuss.gohugo.io/t/pagination-and-group-by-date/1441