Hugo post directory appearing on homepage, but not posts

旧巷老猫 提交于 2020-12-12 06:08:37

问题


For my blogdown-created website (using the Xmin theme), the posts directory - from which I can view individual posts - appears on the homepage, instead of individual posts.

https://joshuamrosenberg.com/

This seemed to happen after updating to the lastest version of Hugo. The source for my website is here. I'm a bit puzzled about what to do: do you have any advice?


回答1:


This is due to a breaking change in Hugo 0.57.0, and I have fixed the issue in the latest version of the XMin theme. Basically you need to replace

{{ range (where .Data.Pages "Section" "!=" "") }}

with

{{ $pages := .Pages }}
{{ if .IsHome }}{{ $pages = .Site.RegularPages }}{{ end }}
{{ range (where $pages "Section" "!=" "") }}

in the template file layouts/_default/list.html.



来源:https://stackoverflow.com/questions/59919045/hugo-post-directory-appearing-on-homepage-but-not-posts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!