Template functions · Pages

hash

A short content hash of a source file, for cache-busting asset URLs.

hash "/file"

Returns the first 10 hex characters of the SHA-256 of src/<file>. Add it to stylesheet and script URLs and browsers fetch a fresh copy when the file changes, and only then. Unlike .BuildID, pages stay byte-for-byte the same between builds when nothing changed, so -publish doesn't upload them again.

It hashes the source file, so for a file with a build: command the hash follows the source, not the command's output. If the file can't be read, the error is logged and the result is empty.

Example

<link rel="stylesheet" href="{{ path "/css/styles.css" }}?v={{ hash "/css/styles.css" }}">
<!-- /css/styles.css?v=3f2a91bc4d -->

data sources sort filter limit offset select paginate pages page path json contains html js css

Edit this page · Last updated 2026-11-20