HUGO

Use variable within a variable in the Front Matter

Hey all, is it possible to use a variable within a variable in the front matter? Here’s an example:

---
url: /test-post/
image: ${url}image.jpg
---

Essentially all I am trying to accomplish is avoiding having to type the full path (/test-post/image.jpg) to the image in the “image” front matter. Perhaps there is another way?

Directory structure:

content
—post
-----test-post
------image.jpg

No this is not possible.

Template variables and functions can only be used in archetypes, but even then your example above is not the way to define a variable.

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