Yaml 雨果降价元数据
我想在网页上显示标记文件中的元数据,因此我尝试使用变量名(例如{.Author})访问它 这对.Title和.Content变量很好,但对其他变量不起作用!似乎我缺少了一个关于如何使用这些的重要细节。使用.Author变量,页面上的输出为{map[]} 提前谢谢 降价文件:Yaml 雨果降价元数据,yaml,markdown,metadata,hugo,toml,Yaml,Markdown,Metadata,Hugo,Toml,我想在网页上显示标记文件中的元数据,因此我尝试使用变量名(例如{.Author})访问它 这对.Title和.Content变量很好,但对其他变量不起作用!似乎我缺少了一个关于如何使用这些的重要细节。使用.Author变量,页面上的输出为{map[]} 提前谢谢 降价文件: --- title: ABC author: "Foo Bar" position: Manager --- The actual content ... {{ range where .Data.Pages "Typ
---
title: ABC
author: "Foo Bar"
position: Manager
---
The actual content ...
{{ range where .Data.Pages "Type" "type"}}
<section>
<div>
<div>
{{ .Title }}<br>
{{ .Content }}
</div>
<div>
{{ .Author }}<br>
{{ .Position }}
</div>
</div>
</section>
{{ end }}
网页:
---
title: ABC
author: "Foo Bar"
position: Manager
---
The actual content ...
{{ range where .Data.Pages "Type" "type"}}
<section>
<div>
<div>
{{ .Title }}<br>
{{ .Content }}
</div>
<div>
{{ .Author }}<br>
{{ .Position }}
</div>
</div>
</section>
{{ end }}
{{range where.Data.Pages“Type”“Type”}
{{.Title}}
{{.Content}
{{.Author}}
{{.Position}
{{end}
结果表明,您需要通过.Params变量访问非标准参数
有关信息,请参阅
{{ range where .Data.Pages "Type" "type"}}
<section>
<div>
<div>
{{ .Title }}<br>
{{ .Content }}
</div>
<div>
{{ .Params.author }}<br>
{{ .Params.position }}
</div>
</div>
</section>
{{ end }}
{{range where.Data.Pages“Type”“Type”}
{{.Title}}
{{.Content}
{{.Params.author}}
{{.Params.position}
{{end}