Very simple question coming up!
- In my Apostrophe header I want to 'hard-code' an image to always display in a certain (banner) location.
- I do NOT want any editor/user to be able to change or remove the image
- so I'm assuming I do NOT need to use any singleton-type approach
- and that I do NOT need any type of widget.
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.