hugo/content/en/methods/shortcode/Page.md
Bjørn Erik Pedersen 9b0050e9aa Squashed 'docs/' content from commit 5c085a37b
git-subtree-dir: docs
git-subtree-split: 5c085a37b297bf12f59efeaae591418ec025c10d
2024-01-27 10:48:33 +01:00

807 B

title description categories keywords action
Page Returns the Page object from which the shortcode was called.
related returnType signatures
hugolib.pageForShortcode
SHORTCODE.Page

With this content:

{{< code-toggle file=content/books/les-miserables.md fm=true >}} title = 'Les Misérables' author = 'Victor Hugo' publication_year = 1862 isbn = '978-0451419439' {{< /code-toggle >}}

Calling this shortcode:

{{</* book-details */>}}

We can access the front matter values using the Page method:

{{< code file=layouts/shortcodes/book-details.html >}}

  • Title: {{ .Page.Title }}
  • Author: {{ .Page.Params.author }}
  • Published: {{ .Page.Params.publication_year }}
  • ISBN: {{ .Page.Params.isbn }}
{{< /code >}}