DEV Community

Dani Toranzo
Dani Toranzo

Posted on

 

Help: Same nav and footer in the whole portfolio.

Hi guys,

I would like to put the same nav and footer in my entire portfolio and I only want to change it in one place, not change them in all the pages one by one. How would you do it? What do you think would be the best or simple method?

I'm using Html, css and bootstrap.

Here is my portfolio www.danitoranzo.com
Thank you for your help.

Top comments (2)

Collapse
 
dianale profile image
Diana Le

If this is a static site where each page is a separate html file that is manually updated, the only way you can standardize components like the header and footer is to use some type of templating system. You could use PHP for templates, but that doesn't work if the server doesn't run PHP.

Here's an article on Nunjucks, which I've used in some tutorials: smashingmagazine.com/2018/03/stati.... This will require Node.js however and compiling your site. I would say the best option down the road is to use a static-site generator (like Eleventy), but this will require a learning curve to get started. I'm learning to do these things right now myself and it's challenging but I think once I've learned how to do these, it will make future sites much easier.

Conversely you could also use a CMS (like Wordpress) which handles the templating management for you, but that is also another learning curve and you'd have to re-style and recode your site to fit the template or code your own.

Collapse
 
danitoranzo profile image
Dani Toranzo

Hi Diana,
Thanks for your help. I'll investigate your two first proposals. I wouldn't like to use a CMS (I know how to use it) because is a challenge for me to do with another method and because as you say I would have to change the whole portfolio. Thanks again, because I needed a place to start and now I have two.