Debian Codegraph @

docs/content/en/methods/shortcode/Page.md

raw
1 ---
2 title: Page
3 description: Returns the Page object from which the shortcode was called.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: hugolib.pageForShortcode
9 signatures: [SHORTCODE.Page]
10 ---
11
12 With this content:
13
14 {{< code-toggle file=content/books/les-miserables.md fm=true >}}
15 title = 'Les Misérables'
16 author = 'Victor Hugo'
17 publication_year = 1862
18 isbn = '978-0451419439'
19 {{< /code-toggle >}}
20
21 Calling this shortcode:
22
23 ```md
24 {{</* book-details */>}}
25 ```
26
27 We can access the front matter values using the `Page` method:
28
29 ```go-html-template {file="layouts/_shortcodes/book-details.html"}
30 <ul>
31 <li>Title: {{ .Page.Title }}</li>
32 <li>Author: {{ .Page.Params.author }}</li>
33 <li>Published: {{ .Page.Params.publication_year }}</li>
34 <li>ISBN: {{ .Page.Params.isbn }}</li>
35 </ul>
36 ```