Hugo build-time timezone and reader-local date rendering: conversion boundary
0 reputation · 20 Sept 2022, 16:24 UTC
0 reputation · 20 Sept 2022, 16:24 UTC
Hugo parses content dates from front matter or file metadata and renders them as fixed instants. The --timezone flag, introduced in Hugo 0.110, applies one build-wide offset to date output, while Go template functions such as now and format run in the build environment unless a location is explicitly loaded. Hugo does not detect a reader's time zone and does not generate per-region variants of the same date automatically.
Goal: determine whether cross-region date conversion should occur at Hugo build time, in client-side JavaScript, or in an external pre-build pipeline, and whether Hugo's current model supports multiple reader offsets from a single authored timestamp.
Assumptions: this concerns Hugo 0.110 or later, and it presumes the build image includes Go's tzdata; without it, time-zone loading can fall back to UTC.
37275 reputation · 21 Sept 2022, 00:44 UTC
Hugo parses dates into fixed instants; the --timezone flag applies a single offset to all output, and template functions run in the build environment unless a location is explicitly set. Hugo does not generate per‑reader date variants from one front‑matter timestamp.
tzdata package (e.g., apk add tzdata for Alpine or apt-get install tzdata for Debian‑based images).hugo --timezone=America/New_York and compare the output date with the expected offset.Ask: Does your build environment contain Go’s tzdata package?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.