hugo升级后设置页面-上下页按钮
将hugo升级至版本hugo_extended_0.147.8_windows-amd64,发现原来的search页面,搜索框没有显示出来,在搜索页面按F12,发现未加载search.html中的内容,难道新版本改变了部分模板语法?空了得折腾折腾。
default\single.html中添加, 判断当前页面的类型(是否为文章类型),只有在页面类型为“post”时,才会渲染上下页的
_{{ if eq .Type "post" }} <!-- 检查页面类型是否为文章 --> <div class="pagination" style="margin: 30px 0;padding: 15px 0 0;color: #6b7280;border-top: 1px solid;"> {{ if .NextInSection }} <span>较新的一篇: <a href="{{ .NextInSection.Permalink }}">{{ .NextInSection.Title }}</a></span> {{ else }} <span>已经是最新文章</span> {{ end }} <br> {{ if .PrevInSection }} <span>较旧的一篇: <a href="{{ .PrevInSection.Permalink }}">{{ .PrevInSection.Title }}</a></span> {{ else }} <span>已经是最旧文章</span> {{ end }} </div>{{ end }}
也就是在这段代码中间添加相应的div
{{ if eq .Type "post" }} <!-- 检查页面类型是否为文章 -->...{{ end }}
hugo加载挺快的
我那个hugo 就不管了。屯一些然后git 同步一下就完事。其他都不管了。
我偶尔也折腾一下hugo![[整理发型]](https://illl.xyz/wp-content/themes/Simple/img/smilies/整理发型.png)