Very simple question coming up!
So, all I'm trying to do is the most basic of HTML:
<img src="myfile.jpg">
Yet I face 2 problems:
1) when I use the above I get
"TypeError: Cannot read property '_id' of null"
...followed by lots of errors, then
"^^^^^ LOOK UP HERE FOR THE LOCATION WITHIN YOUR HELPER e.stack: Template render error: (apostrophe-pages:notFound.html) Template render error: (apostrophe-pages:notFound.html)"
...followed by lots more errors
2) I've no idea which directory in which to store the image (should it be in a module directory?). I don't want to store it in the main 'image library'
Presumably some form of Nunjucks coding is required?
Thanks!
You wouldn't get that error from having a broken src in regular old HTML. Maybe paste the full error or comment out some recently added code out to deduce that error.
To answer your question, Apostrophe makes the /public
directory available as the root, so if you place an image file in, say, /public/images/myfile.jpg
you should be able to access it from <img src="/images/myfile.jpg" />
in your template.