How to use Front Matter variable inside content

Is it possible to use custom Front Matter variable inside the content of the file ?

I.e. sample post.html ( file :


title: "New post"
date: 2021-04-29T16:00:58+02:00
draft: false
my_var: "abcdef"
This is value of my variable : {{ my_var }} 

I tried my_var .Content.my_var, Page etc. but it doesn’t work . Is it even possible?

No this is not possible.

Instead use:

Of course, you can use an Inline Shortcode inside the markdown.

{{< var.inline >}}{{ .Page.Params.my_var }}{{< / var.inline >}}

To use it, remember to enable this feature in config.

enableInlineShortcodes: true


Try {{< param my_var >}}. Shortcodes | Hugo

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.