我想使用 .toml 文件在 hugo 主页上显示博文

问题描述 投票:0回答:1

我正在尝试使用 hugo 建立一个博客网站。除了在主页上显示博客列表外,我网站上的一切都很好。我想在主页上显示所有博客,但我的主题没有自动显示。我正在使用Mediumish主题。在这个主题中,如果我在 config.toml 中添加任何内容,它将显示在主页中。主页上有一些文字内容。现在,我想用博客列表替换它们。我该怎么做?

提前致谢!

注意:目前博客显示在 cold-email-bootcamp slug - https://splendid-pavlova-fbf620.netlify.app/cold-email-bootcamp/

代码链接:https://github.com/shawon111/hugo-sharable 直播网站链接:https://splendid-pavlova-fbf620.netlify.app/

hugo hugo-content-organization
1个回答
1
投票

不知道主题是如何设置的,但如果你想在主页上显示所有内容

在 index.html 中:

{{ range .Site.Pages }} 
{{ .Content }} 
{{ end }} 

你可能想要:

{{ range .Site.Pages }} 
<article> 
<h4>{{ .Title }}</h4> 
<p>{{ .Summary }}</p> 
<a href="{{ .Permalink }}">Read more</a> 
</article> 
{{ end }}
© www.soinside.com 2019 - 2024. All rights reserved.