0

I know that this question is not more coding based. But this can cause many problems practically.

I have a website with 10 pages. Each page has the same navigation. Now if I want to change the navigation a little to include a hamburger menu, I will have to make this change in each page one by one. Is there any way in which I can make this common change to all the pages at the same time?

I browsed for this on SO but the answers to a similar question asked to use PHP or WordPress. Is there any method or tool other than them for my requirements?

Praneet Dixit
  • 1,393
  • 9
  • 25
  • What have you tried to achieve this ? Stack-over flow is not a free coding service you need to provide us your efforts to achieve this or if you are stuck at something ? Please do your own research or provide a [minimal example](https://stackoverflow.com/help/minimal-reproducible-example) of your work. Read here how to ask a [GOOD question](https://stackoverflow.com/help/how-to-ask) – Always Helping Jul 05 '20 at 07:25
  • if change is small you could do it via css (if same style sheet file is included in all html files) but in this case - hamburger is menu - and I doubt you can do it via css only - there should be some html mods - or JS (if you have it included sure) – Kresimir Pendic Jul 05 '20 at 07:25
  • @AlwaysHelping Thanks for the response. I am not asking you how to make a menu. I am trying to know how to apply the same change in HTML to different pages. As for what I have done, I have browsed the web for the possible tools before posting this question. – Praneet Dixit Jul 05 '20 at 07:36

1 Answers1

1

With HTML, I don't think there's any support for that kind of dynamic feature yet.

However, if you seek to want to make changes on a portion of your website and see it apply to every other page on your website that has the same portion, there are frameworks, libraries and even template engines that support such.

You may need to use HTML alongside these tools or just use them to replace HTML. For instance, when building a website with Node and Express, there are a good number of template engines that you can make use of that can be used alongside HTML to make your website dynamic. I would recommend that you try out one of the following: pug, ejs, handlebars. I believe you can achieve that level of dynamism with one of them.

You can also decide to use front end libraries or frameworks like react, vue and angular. These tech tools enable you to create a portion of a website(called a component) once and reuse it on as many pages as you want. Anytime you make a change to that component, it automatically adjust itself on every other page it has been inserted.