【发布时间】:2021-11-13 16:43:23
【问题描述】:
layouts/index.html:
{{define "main"}}
{{ $products := .Site.RegularPages.ByTitle "Section" "products" }}
{{with .Params.banner}}
[...]
<div class="dropdown-menu">
{{ range (where $products ) }}
<a class="dropdown-item " href="{{ .Permalink }}">{{ .Title }}</a>
{{ end }}
[...]
产生这个错误:
ERROR: executing "main" at <.Site.RegularPages.ByTitle>: wrong number of args for ByTitle: want 0 got 2
好的,让我们尝试删除我猜的那两个(必要的)参数?
{{ $products := .Site.RegularPages.ByTitle }}
现在,错误提示:
ERROR: executing "main" at <where>: wrong number of args for where: want at least 2 got 1
这里发生了什么?第一段代码在我的layouts/header.html 中运行良好,但现在 Hugo 似乎很困惑。
【问题讨论】:
标签: javascript hugo