Variables inside readFile?

Hiya everyone,
Just playing around with Hugo and wanted to know if you can have variables inside a readFile ?

index.html

{{ readFile "/content/templates/test" }}

test.html

{{ .Site.Title }}

at the moment I only see {{ .Site.Title }} as it outputs {{ .Site.Title }} as plain text and doesn’t pass any site variables. What did I do wrong?

Thanks

So, there is a way to do that, but I would start asking … why do you need that?

2 Likes

Just playing around and expanding my template/theme abilities. Love playing around with new ideas and leaning new things with Hugo.