...when you can get a computer to do it for you?
As this site grew beyond a few pages I found myself increasingly inhibited from adding new pages because of the amount of drudgery involved. Adding one page usually involves adjusting the menus on many other pages, a tedious and error-prone task. Moving a page in the structure of the site involves a similar amount of work, which gave another reason to delay adding new pages: endless dithering about where they should go, because I didn't want to change my mind later. The whole business demanded to be automated. Hence, over several iterations, my Excel-based site builder evolved. It consists of a spreadsheet and several acres of Visual Basic.
Each page is generated from a template which defines the structure of the page but which contains no content of any kind. Building the .html file for a page involves copying the template to the "object" .html. Along the way directives in the template cause other items to be inserted:
- The page's content (the stuff in the main panel) is inserted by including a file. There is one such content file for each page: it contains the HTML markup for the content, and nothing else.
- The HTML and CSS certificates are also added by including a file.
- The navigation menu is generated by the Visual Basic program.
- Items such as the page title, subtitle, and the fields for the HTML "head" section are substituted from cells in the spreadsheet.
The navigation structure of the site is defined by a page of the spreadsheet in which the names of the .html files are laid out as a site map. The menu generation consults this table and generates the menus accordingly. Alterations to the site structure are done simply by moving items around the table. Another table defines the contents of the What's New page.
There is one template file for all of the ordinary pages, and separate templates for the home page (which has a different layout) and for the site map and What's New pages (both of which consist entirely of automatically generated content).
The actual building of the site takes approximately 3 seconds (for the site as it is at the time of writing with about 25 pages).
Why didn't I just buy a website-building application? The first reason is that doing it this way gives me relief from tedium while retaining complete control over the HTML that is produced.The second reason is that it's much more fun this way.
