Pages with non-default content types (raw mode, api mode, or custom
content_type:) store the content type in a sidecar cache file so
that cache hits can serve the correct Content-type header without
re-reading the source.
public_html/lazysite/cache/ct/
Path separators are replaced with colons. For example, api/status
becomes api:status.ct. The file contains only the content type
string.
A .ct file is written when the page's content type is not the
default text/html; charset=utf-8. This applies to:
api: true pages (default: application/json; charset=utf-8)raw: true pages (default: text/plain; charset=utf-8)content_type: in front matterOn cache hits (the fast path in main()), the .ct file is read
to determine the correct Content-type header. If no .ct file
exists, the default text/html; charset=utf-8 is used.
When a page is rendered and its content type is the default (or
undefined), any existing .ct file for that path is deleted. This
handles the case where a page changes from api: true back to
normal mode.
$ cat public_html/lazysite/cache/ct/api:status.ct
application/json; charset=utf-8