lazysite caches rendered pages as .html files alongside their .md
sources. The cache is transparent - Apache's DirectoryIndex serves
the .html file directly without invoking the processor.
A cached .html file is served when:
.html file exists and its mtime is newer than the .md sourcettl: in front matter and the cache age is within
the TTL (even if the .md file is newer)Cache is skipped when:
LAZYSITE_NOCACHE is setquery_params:)After processing a page, the rendered HTML is written to the
corresponding .html path. Cache writes are skipped when:
LAZYSITE_NOCACHE is setDelete the cached .html file:
rm public_html/my-page.html
The next request to /my-page regenerates and caches it.
Clear all cached pages:
find public_html -name "*.html" ! -path "*/lazysite/*" -delete
Set ttl: in front matter to keep serving the cache even when the
.md source is newer:
---
ttl: 300
---
The TTL is in seconds. This is useful for pages with url: or scan:
variables that should not regenerate on every source file touch.
When a page has ttl: set, the processor sends a
Cache-Control: public, max-age=TTL HTTP header. This tells the
browser to cache the response for that duration without revalidating.
Pages without ttl: do not send a Cache-Control header - browser
behaviour depends on its defaults.
When LAZYSITE_NOCACHE is set, the Cache-Control header is still
sent if the page has ttl: - NOCACHE only affects the server-side
.html cache, not browser cache headers.
.html file must have the same name as the .md file (e.g.,
about.md caches to about.html).html files are never written - this prevents empty
cache files from blocking regeneration via DirectoryIndex