hugo/content/functions/readfile.md
Bjørn Erik Pedersen ec4e6f9df2 Squashed 'docs/' content from commit f887bd7b
git-subtree-dir: docs
git-subtree-split: f887bd7b4e3e7c7e76cd63951e5b0d37d8fe0ac7
2017-08-10 17:18:22 +02:00

773 B

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

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.