Open zenkimoto opened 2 years ago
I looked into this a little bit. The EJS set up code in question is here:
https://github.com/adhocteam/nytimes-library/blob/main/server/index.js#L34-L35
This sets the EJS templates to resolve in the ./custom/layouts
folder first, then resolves to ./layouts
.
However, if that is the case, then I don't know why this function is needed:
https://github.com/adhocteam/nytimes-library/blob/main/server/utils.js#L12-L31
Which is what is used to fetch the top-level templates.
What I don't understand is when it goes through and resolves partials. I assume it should be using the above where the ./custom/layouts
folder is resolved first. I guess if it's a partial and it's already in the ./layouts
folder, it doesn't go back to the ./custom/layouts
folder to resolve partials? 🤷♂️
Context (Environment)
When creating a custom EJS file, you'd copy the EJS file from the
layouts
folder intocustom/layouts
. However, if the EJS file is a child EJS file (another EJS file includes it), the file doesn't get included unless the parent EJS file (the one including the child EJS) is also part of thecustom/layouts
folder.Recently, there were changes to
partial/search.ejs
. However, the changes didn't appear in the search results screen. I had to include in thecustom
folder:partial/nav.ejs
in order for the search changes to appear.Expected Behavior
Use custom EJS only if the EJS file is there regardless of parent.
Actual Behavior
Includes custom EJS files only if the parent is a custom EJS file.
To Reproduce
custom/layouts
folder.Additional Information
This may be a problem with how the Content Library is set up or maybe it's just how EJS operates. This ticket is meant for an investigation into the issue and present a possible solution.