ByWeight
语法
PAGES.ByWeight
返回
page.Pages
使用前言中的 weight
字段为页面分配权重。权重必须是非零整数。较轻的项目浮到顶部,而较重的项目沉到底部。未加权或零权重的页面放置在集合的末尾。
{{ range .Pages.ByWeight }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}
按降序排序
{{ range .Pages.ByWeight.Reverse }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}