How to easily manage a navigation bar across many webpages

Hi!

Are you a webmaster and you have many pages and you want to add something new to your navigation bar, but you dread it because you have to add it to every single page?

Well, here is a tutorial that shows you how to change the nav bar easily across all pages!

First, you will want to make a file called nav.html or anything, really. But I would name it something about navigation so you know what it is.

Second, you want to put the code for the navigation bar in it.
For example:
in nav.html...
<div>
  <a href="coolpage.html">Cool Page!!</a>
  <a href="coolpage2.html">Cool Page!! The sequel!!</a>
</div>

Yup, no <html> or <body> tags.

Third, there are three methods. The first one I will explain is with pure Javascript.

Method #1: Pure Javascript

You do not need the nav.html for this method.
I did not know of this method until 1 day after writing this tutorial. If I wrote it down, it would kinda be copying so I will just leave a link to this method.

Method #2: JQuery

To use JQuery, you will want to most likely use a CDN. You can link to the CDN with this code in the <head>:
in whatever.html...
<script src="cdn.cdn/jquery.js"></script>
I recommend you use the CDN from the official site.

Next you want to create a div where your nav used to be then you want to load the nav.html in the page, so you would do that with this code:
in whatever.html...
<div>cool page content here!</div>
<div>ok here is navigation bar below!!</div>
<!-- OOH ITS THE NAVIGATION BAR!! -->
<div id="nav"></div>
<!-- OOH ITS THE CODE THAT MAKE THE NAVIGATION BAR APPEAR!! -->
<script>
$(function(){
  $("#nav").load("nav.html");
});
</script>
<!-- OHHhhhh thats the end of the navigation bar. -->
<div>cool page content continues here!!!</div>

Method #3: PHP

Now, I don't know if you can use .php files on Neocities, but you will need your whatever file to be PHP, like whatever.php.

For this one you don't need to link to anything or make a placeholder, simply just put this:
in whatever.php...
<?php 
  include 'nav.html';
?>
Where your nav used to be.

So, here is an example:
in whatever.php...
<div>cool page content here!</div>
<div>ok here is navigation bar below!!</div>
<!-- OOH ITS THE NAVIGATION BAR!! -->
<?php 
  include 'nav.html';
?>
<!-- OHHhhhh thats the end of the navigation bar. -->
<div>cool page content continues here!!!</div>



And thats it!
Sorry if it was confusing, I'm not too good at explaining things.