We already know about templating engine right? Now tell me one thing, if you have 10 pages, how you’ll handle the navbar ? Can we reuse the navbar for every page ?

Answer is YES. We can but we need to make the navbar as partials. Partials is a concept in ejs

So create a folder inside our view folder call it partials. We’ll store the partial files here.

Let’s start creating from head files. Like the cdn’s we are going to use. Let’s try bootstrap in our case.

I’m using the navbar from bootstrap 4 too. https://getbootstrap.com/docs/4.4/components/navbar/

Let’s add the footer also

Now we can easily use this partial parts easily

See the result

Do you understand how we can easily do many things using partial templating ?

Leave a Reply

Your email address will not be published. Required fields are marked *