HUGO
News Docs Themes Community GitHub

Page

Returns the Page object from which the shortcode was called.

Syntax

SHORTCODE.Page

Returns

hugolib.pageForShortcode

With this content:

---
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"
}

Calling this shortcode:

{{< book-details >}}

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

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>