I generated a express website using express-generator and i need to reference a partial hbs file that is inside a subfolder within the views folder.
my folder Structure is like this
From within my main layout file (layout.hbs) i am referencing the head and nav_bar files which i get an error that the head file cant be found
Error is
C:\MovementForNewNigeria\app\views\index.hbs: The partial head could not be found
Error: C:\MovementForNewNigeria\app\views\index.hbs: The partial head could not be found
at Object.invokePartial (C:\MovementForNewNigeria\app\node_modules\handlebars\dist\cjs\handlebars\runtime.js:266:11)
at Object.invokePartialWrapper [as invokePartial] (C:\MovementForNewNigeria\app\node_modules\handlebars\dist\cjs\handlebars\runtime.js:68:39)
at Object.eval (eval at createFunctionContext (C:\MovementForNewNigeria\app\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:254:23), <anonymous>:6:28)
at main (C:\MovementForNewNigeria\app\node_modules\handlebars\dist\cjs\handlebars\runtime.js:173:32)
at ret (C:\MovementForNewNigeria\app\node_modules\handlebars\dist\cjs\handlebars\runtime.js:176:12)
at ret (C:\MovementForNewNigeria\app\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:525:21)
at C:\MovementForNewNigeria\app\node_modules\hbs\lib\hbs.js:87:17
at C:\MovementForNewNigeria\app\node_modules\hbs\lib\hbs.js:69:11
at done (C:\MovementForNewNigeria\app\node_modules\hbs\lib\async.js:74:20)
at C:\MovementForNewNigeria\app\node_modules\hbs\lib\hbs.js:64:20
The solution was to register the partial or more efficiently register all partials
with
var hbs = require('hbs');
hbs.registerPartials(__dirname + '/views/partials');
https://github.com/pillarjs/hbs
Thanks to turmuka for helping with the hbs import.