Template files

Template files are similar to include files in that they are fixed assets stored outside of your local site root that you can call upon again and again to help automate the creation of webpages. Unfortunately, they are not as handy as include files.

A BBEdit template file looks like this:


<!DOCTYPE html>
<html lang="en-US">
<head>
<!-- #bbinclude "meta.incl" --><!-- end bbinclude -->
  <title>#TITLE# || BBEdit for websites</title>
</head>
<body id="top">
<!-- #bbinclude "header.incl" --><!-- end bbinclude -->
<h1>
  #TITLE# 
</h1>
<p>
  Your content goes here. 
</p>
<!-- #bbinclude "nav.incl" --><!-- end bbinclude -->
<!-- #bbinclude "footer.incl" --><!-- end bbinclude -->
</body>
</html>

Choose FileNewHTML Document … and select your template file name to create a new webpage with the format and includes you have specified.

Do not store your BBEdit template files inside your local site root folder, either. See Project Organization for one way of managing your files.

The problem with template files is that if you decide to rearrange all the pages in your website, you cannot simply edit your template file(s) and update your site. Therefore, template files are more helpful for creating new pages than they are for maintaining an existing website — even one built using template files in the first place. However, with clever use of include files, you can make website maintenance much more automated, or at least semi-automated.