Page
返回调用 shortcode 的页面对象。
Syntax
SHORTCODE.Page
Returns
hugolib.pageForShortcode
使用此内容:
---
author: Victor Hugo
isbn: 978-0451419439
publication_year: 1862
title: Les Misérables
---+++
author = 'Victor Hugo'
isbn = '978-0451419439'
publication_year = 1862
title = 'Les Misérables'
+++{
"author": "Victor Hugo",
"isbn": "978-0451419439",
"publication_year": 1862,
"title": "Les Misérables"
}
调用此 shortcode:
{{< book-details >}}我们可以使用 Page 方法访问 front matter 值:
layouts/_shortcodes/book-details.html
<ul>
<li>Title: {{ .Page.Title }}</li>
<li>Author: {{ .Page.Params.author }}</li>
<li>Published: {{ .Page.Params.publication_year }}</li>
<li>ISBN: {{ .Page.Params.isbn }}</li>
</ul>