【发布时间】:2020-06-01 19:15:50
【问题描述】:
我使用 Hugo 创建了一个静态站点,使用 Hyde-Hyde 主题,但我无法让主页(或帖子页面)上的帖子摘要按日期排序。我知道使用不同的主题可以修复后期排序,但这个问题专门是关于让它与 Hyde-Hyde 主题一起使用。以下可重现的代码示例:
这是使用 Hyde-Hyde 主题(及其 exampleSite 内容)获取新 Hugo 站点的代码:
~/$ hugo new site mySite
~/$ cd mySite
~/mySite$ git clone https://github.com/htr3n/hyde-hyde.git themes/hyde-hyde
~/mySite$ rm -rf themes/hyde-hyde/.git themes/hyde-hyde/.gitmodules
~/mySite$ mv themes/hyde-hyde/exampleSite/* .
我们现在可以构建网站并在本地提供服务:
~/mySite$ hugo
~/mySite$ hugo serve
...告诉我们我们的网站在http://localhost:1313/
如果您单击localhost 链接,您将看到一个类似于(但不完全相同)从the Hyde-Hyde theme homepage 链接的“演示”页面的站点。但是,主页(和“帖子”页面)上的帖子不是按日期排序的;您会注意到前三个帖子的日期为 2014 年 9 月,然后是 2014 年 3 月,然后是 2014 年 4 月。
根据the github issue I filed,到目前为止我已经尝试过更改
{{ with .Data.Pages }}
到
{{ with .Data.Pages.ByDate }}
在themes/hyde-hyde/layouts/partials/page-list/content.html
和
{{ range . }}
themes/hyde-hyde/layouts/partials/posts-list.html 中的一些不同的东西,
但我无法让帖子按日期排序显示在主页和“帖子”页面上。
【问题讨论】:
标签: hugo static-site