In this video we are going to learn about Partial templates.
EJS partials, which are used to help us to avoid repetition of the same code on several web pages.
So lets see how can we use partials templates.
So go to the project and here first of all lets create a folder inside the views directory.
So just click on new folder.
Lets say folder name is partials.
Inside the partials folder just create new file.
Lets say file name is head.ejs.
Create another file header.ejs and create one more file footer.ejs.
Now inside the head.ejs.
Add the bootsrap cdn.
So go to the getbootrap.com.
From here just copy this bootstrap.min.css cdn and paste inside head.ejs.
Now copy bootsrap js cdn and paste inside the footer.ejs.

Now go to header.ejs file and create navigation.


<nav class=\"nav\">
<a class=\"nav-link\" href=\"/\">Home</a>
<a class=\"nav-link\" href=\"/about\">About</a>
<a class=\"nav-link\" href=\"/contact\">Contact</a>
</nav>


Now goto the footer.ejs and add the following.


<footer class=\"footer\">
<p class=\"text-center\">© 2020 Surfside Media. All rights reserved</p>
</footer>


Now use these partials into the home,about and contact page.
So go to the home.ejs and just add inside the head section.

<%- include('partials/head') %>


Now inside the body add the header.


<%- include('partials/header') %>



Now on bottom add the footer.


<%- include('partials/footer') %>


Now lets run.
So goto the command prompt and run the command.


node index.js


Switch to the browser and refresh the page.
You can see here the partials header and footer.
If click on about, you can see the about page and if I click on contact you can see Contact us page.
So in this way you can use the partial templates.