Hi! For the life of me I cannot seem to get readFile (or the shortcode) working. No matter what I do I just get the following sort of error:
ERROR 2017/12/06 08:13:40 Unable to locate template for shortcode "readfile" in page "parameters/_index.md"
As a side note, I wish it included in the error the absolute path to the file that it’s having an issue with to help with debugging.
Is the path relative to where the shortcode is called? Is it relative to the project? Does it matter if it has a leading slash? I’ve tried reading files all over the project, and I cannot seem to get it to work.
My ultimate goal is to have portions of content that can be easily pulled into various places. I thought a shortcode might be a good fit for this. (I’m confused whether to use whether to use shortcodes or functions in shortcode .html files. I tried both.) I was thinking I do do something like this:
{{< parameter my-parameter >}}
The shortcode would take the first argument and include the my-parameter.md file from the /parameters directory.
When that didn’t work I just tried using the readfile shortcode from the template, but to no avail:
After some digging, it seems like the error is actually telling me there is no readfile shortcode. Isn’t that inlcuded in Hugo? If it’s new is there something I need to do to and existing project to make it available?
I am in the same boat. So where do we find the sourcecode for the shortcode? Is there a collection of them I can download somewhere? I’d rather not have to code them myself if I can help it!
I am utterly dismayed this was this hard. FWIW, Jekyll has built in include of content. Anyhow, here is the source of my /layouts/shortcodes/readfile.html