Fall back to hugo.buildDate in hugo.BuildDate() in non-vcs builds

Fixes #14862
This commit is contained in:
Bjørn Erik Pedersen
2026-05-11 12:26:13 +02:00
parent db40fada48
commit 28147cb040
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -61,6 +61,11 @@ type BuildInfo struct {
GoVersion string
}
// GetBuildDate returns the build date if set by -ldflags="-X github.com/gohugoio/hugo/common/hugo.buildDate="
func GetBuildDate() string {
return buildDate
}
// GetBuildInfo returns the build info for the current binary.
func GetBuildInfo() *BuildInfo {
bi := getBuildInfo()
+4
View File
@@ -532,6 +532,10 @@ func newHugoSites(
opts.GoVersion = bi.GoVersion
}
if opts.BuildDate == "" {
opts.BuildDate = hugo.GetBuildDate()
}
h.hugoInfo = page.NewHugoInfo(opts)
var prototype *deps.Deps