I’ve got git repo which contains both the hugo docs and app source code, structured like this:
- docs
- bookshelf
- content
- etc
- src
- code here
I’m wanting to use the readfile
shortcode to read some of the files into the docs to embed them as code snippets, so I’m doing something like this:
{{ readFile "../src/some-file.js" }}
But I get an error saying the file doesn’t exist. Now, I know it exists on disk (doing an ls
on the path shows it’s there) so my guess is that because it’s outside the “hugo source” folder it thinks it doesn’t exist. So, is there a way that I can reference that file to read its contents and embed, or can I only use readFile
with files inside the path specific in the --source
argument to hugo server
?