: "don't throw away your structured data". One way I've handled this kind of thing is to have a table with a primary key of unique page names and foreign keys for a template name and a content identifier. Creating a static version of the website consists of traversing the page names, selecting the referenced template and content from their respective tables, and generating a static page. Even a moderatly large site can be generated in a matter of seconds so I would just regenerate the site whenever either the content or the template tables were modified. If you have a very large site and don't want to regenerate the whole thing for each modification, include a "last-modified" column. Another trick I'd use - have the script act as a CGI and generate a dynamic page when invoked via the web and act as a server-script and generate a static page when invoked from the command line.