-2

I have a website with multiple pages and all of the pages have the same "navbar" and "footer" Is there is a better way to create this without having to repeat the navbar and footer code on every HTML page of the site

In the web version of YouTube when you are on the home page. if you click in "Liked videos" from the sidebar there are some s of the page the wouldn't load like the navbar which contains the YouTube logo and the sidebar which I clicked earlier. Only the content of the page will load and replace the suggested videos with liked videos. with cool red loading animation at the top of the page. I want to create something like that on my website but I don't know how or what should I use? Could JavaScript achieve that? Or do I need something like React JS? I don't know please help me

  • 1
    Does [this](https://stackoverflow.com/questions/31954089/how-can-i-reuse-a-navigation-bar-on-multiple-pages) help answer your question? – user11350388 May 23 '21 at 11:55
  • imho the best solution would be to use `php include`. You dont need any PHP skills for it. – tacoshy May 23 '21 at 11:56
  • @tacoshy The question doesn't mention PHP. How do you know PHP is used for the backend? Do you think `php include` is the best solution for a website hosted with Java Spring or Node.js? – jabaa May 23 '21 at 12:09
  • which is neither mentioned. PHP is the most commonly used server sided language. Most users that ask about this question, doesnt know about this topic. otherwise they wouldnt ask this question in the first place. – tacoshy May 23 '21 at 12:16
  • @tacoshy How do you know there is a server-side language involved? There are many web hosting packages with static Apache hosting. – jabaa May 23 '21 at 12:23
  • You could create a file for that navbar and call on the file on every page, instead of rewriting the code. – JSman225 May 23 '21 at 15:40
  • I would have answered https://stackoverflow.com/questions/18712338/make-header-and-footer-files-to-be-included-in-multiple-html-pages#answer-67663003 , so i put it over there. – G-Cyrillus May 23 '21 at 18:45

0 Answers0