Files
hugo/content/functions/readfile.md
T
Bjørn Erik Pedersen 4e0bca2b1e Remove the needsexamples construct
We need to rework the whole template func docs and, while a good idea, this does not fit into that.
2017-07-16 15:13:35 +02:00

871 B

title, linktitle, description, godocref, date, publishdate, lastmod, categories, menu, signature, workson, hugoversion, relatedfuncs, deprecated, aliases
title linktitle description godocref date publishdate lastmod categories menu signature workson hugoversion relatedfuncs deprecated aliases
readfile readFile Reads a file from disk relative to the current project working directory and converts it into a string. 2017-02-01 2017-02-01 2017-04-30
functions
docs
parent
functions
readFile PATH
readDir
false

readFile reads a file from disk and converts it into a string. Note that the filename must be relative to the current project working directory.

So, if you have a file with the name README.txt in the root of your project with the content Hugo Rocks!:

{{readFile "README.txt"}} → "Hugo Rocks!"

For more information on using readDir and readFile in your templates, see Local File Templates.