DevJourney

HTML/html.nodejs.dj.upayan.dev/web/routes/index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vanilla Site</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <h1>Welcome to the Vanilla Site</h1>
    <p>This is a simple HTML page.</p>

    <div id="header-container"></div>
    <div id="footer-container"></div>

    <script>
      document.addEventListener('DOMContentLoaded', function () {
      // Load Header
      const headerContainer = document.getElementById('header-container');
      fetch('components/header/header.html')
          .then(response => response.text())
          .then(html => {
              headerContainer.innerHTML = html;
          })
        .catch(error => console.error('Error loading header:', error));

      // Load Footer
      const footerContainer = document.getElementById('footer-container');
      fetch('components/footer/footer.html')
          .then(response => response.text())
          .then(html => {
              footerContainer.innerHTML = html;
          })
          .catch(error => console.error('Error loading footer:', error));
      });
    </script>
  </body>
</html>
View on GitHub