I was wondering this because my site is still in design, and i will most likely have more pages than what i plan. So i was thinking, maybe where my navbar is, i could link it to a "links.html" file and instead of having to update all my pages, i could just update that one page. Any ideas?
Thank you for reading.
-Andrew_b

Dani AI

Generated

A single shared navbar is best handled as a maintained partial that gets injected when pages are built or served, so changes only need to be made once. opened the thread with that idea and correctly flagged the maintenance problem if each page keeps a separate copy of the same markup. Modern, practical solutions avoid repeating identical HTML across many files.

Common, practical approaches (short examples):

<!-- Server Side Include (Apache mod_include) -->
<!--#include virtual="/inc/nav.html" -->
<!-- PHP include (pages must be served as .php) -->
<?php include 'inc/nav.html'; ?>
<!-- Client-side fetch for static hosting -->
<div id="nav"></div>

<script>
fetch('/inc/nav.html')
  .then(r => r.text())
  .then(html => document.getElementById('nav').innerHTML = html)
  .catch(e => console.error('Nav load failed', e));
</script>

Each approach has tradeoffs: SSI/PHP run on the server and give fully formed HTML to browsers and bots (best for SEO and accessibility). Client-side fetch works on static hosts without server logic but depends on JavaScript and same-origin access.

Practical tips: use root-relative URLs inside the nav (avoid broken paths), test with "view source" to confirm bots see the navigation, set sensible caching headers, and ensure keyboard/ARIA accessibility on injected markup. For long-term maintenance on static sites, consider a build-step or a static-site generator to assemble pages from a single nav partial before deployment.

iframes. This is solved.

Even with Iframes, you going to have to change every page. Just think about it,

You going to have the same code for:

home, about us, services, contact us ect.

Except the iframe src. So when you want to update, you going to have to change all pages. Yes you can use find and replace, then again, you can do so without iframes. See what I mean?

Use normal frames instead of inline to achieve what you aiming for.

Regards.

Even with Iframes, you going to have to change every page. Just think about it,

You going to have the same code for:

home, about us, services, contact us ect.

Except the iframe src. So when you want to update, you going to have to change all pages. Yes you can use find and replace, then again, you can do so without iframes. See what I mean?

Use normal frames instead of inline to achieve what you aiming for.

Regards.

Normal Frames. Ahh. I shall be researching then. On another forum they said iframes were the way to go.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.