2017-05-25 59 views
1

我在content结构:(HUGO) - 链接到下一个职位

content 
|-post 
| |-00.md 
| |-01.md 
| |-02.md 
|-about.md 

在为我想有一个页脚的职位单模板:

  • 是一个链接到下一篇文章,或者如果没有下一篇文章可用
  • 是文本“待续”。

伪模板的代码,这意味着:

{{ if nextpost.exists }} #. becomes nexpost here 
    <a href="{{ .Permalink }}">{{ .Title }}</a> 
{{ end }} 

nextpost是currentpost + 1


如何创建怎样的联系?

回答

1

这听起来像你想.NextInSection变量。如果您使用with功能,则可以使其按照您的要求工作。

{{ with .NextInSection }} 
    <a href="{{ .Permalink }}">{{ .Title }}</a> 
{{ end }} 

您也可以以类似的方式使用.PrevInSection