All right here comes the answer. Are you ready? Now because we know the code used to work when our header 1
. 2
ejs file was inside our views folder, we know that all we have to do is just change the path in order 3
for EJS to be able to reach it and include it in our home page. 4
Now the only change that has happened is instead of being immediately available inside the views folder 5
our header file is now in a subfolder called partials. 6
So if you remember how directories work, our styles.css is inside /public/css/ 7
styles.css 8
right? 9
So in order to reach our new header location all we have to do is just to update the path inside the string. 10
So we know that EJS already knows to look inside the views folder 11
so that's where we're going to start specifying our file path. And when it's here we're going to tell 12
it to go to this folder called partials and then navigate inside it to find this file called header. 13
And we'll go ahead and do the same for our footer. 14
So now let's hit save. And let's go ahead and refresh our website and you can see that we've recovered 15
our header partial and our footer partial 16
and now our code is laid out the way that it's meant to be with a partials folder and also a views 17
folder inside our views folder and also the rest of our EJS pages. 18
Did you get that right? Now 19
if you had any trouble with any of the previous challenges 20
be sure to take a look at some of the tutorial videos where we spoke about a lot of these things in 21
detail. But otherwise when you're ready, let's head over to challenge 5.