Search code examples
html-generation

Automatic HTML Cache generation tool


Are there any tools that can automatically generate static HTML pages for my currently dynamic website. i.e. generate a unique HTML page for each unique url of my dynamic website.

It would be great if I do not have to change my dynamic web-site code for this.


Solution

  • What language is your dynamic site written in? PHP, for example, works well with a number of caching libraries. I assume your intent is to reduce the number of times these dynamically-generated-yet-prettymuch-static pages have to be output?

    Another method (again, PHP because you didn't specify) would be to prepend and append a set of scripts that could handle caching via the ob_buffer

    prepend pseudo-code:

    if(cache exists and is not too old) {
        serve cached file
        exit();
    }
    start buffer
    

    append pseudo-code

    get buffer contents and save to cache file
    echo buffer contents