node.js - Do I have to rewrite an html header everytime I want to use it? -


i'm trying develop site using node.js. i'm having trouble due unfamiliarity html , node.js. there mechanism in either node.js or html don't have recreate header & footer every single web page (eg: copy paste html code each time)?

not sure answer question it's 1 way add header , footer in html pages without repeating code.

<script>  $(function(){   $("#header").load("header.html");    $("#footer").load("footer.html");  }); </script>  

and in main index.html file be

<div id="header"></div> <div id="content">     main content </div> <div id="footer"></div> 

so complete index.html this

<html> <head>     <title></title>     <script src="//code.jquery.com/jquery.min.js"></script>     <script>          $(function(){           $("#header").load("header.html");            $("#footer").load("footer.html");          });     </script>  </head> <body>     <div id="header"></div>         <div id="content">             main content         </div>     <div id="footer"></div> </body> </html> 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -