Shared helper that emits the <head> build-identity and PWA
script tags every generator must include.
The build-id / build-time meta tags are informational only — they
identify which deploy produced the page (useful for debugging / cache
audits) but are not consumed by any client-side JavaScript.
The pwa-register.js script tag loads the service-worker registration
and relative-time formatting IIFE. A ?v=<BUILD_SHORT> query string
is appended so that immutable-cached old versions are automatically
evicted when a new build is deployed.
Every value is HTML-escaped — BUILD_ID/BUILD_TIME are tightly
formatted (40-char hex / ISO 8601) but defence-in-depth is cheap.
The output is a multi-line string; callers should drop it into the
<head> block alongside other <meta> tags. CSP stays script-src 'self' because the only emitted <script> references a same-origin
file with a defer attribute.
Description
Shared helper that emits the
<head>build-identity and PWA script tags every generator must include.The
build-id/build-timemeta tags are informational only — they identify which deploy produced the page (useful for debugging / cache audits) but are not consumed by any client-side JavaScript.The
pwa-register.jsscript tag loads the service-worker registration and relative-time formatting IIFE. A?v=<BUILD_SHORT>query string is appended so that immutable-cached old versions are automatically evicted when a new build is deployed.Every value is HTML-escaped —
BUILD_ID/BUILD_TIMEare tightly formatted (40-char hex / ISO 8601) but defence-in-depth is cheap.The output is a multi-line string; callers should drop it into the
<head>block alongside other<meta>tags. CSP staysscript-src 'self'because the only emitted<script>references a same-origin file with adeferattribute.