mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Fall back to hugo.buildDate in hugo.BuildDate() in non-vcs builds
Fixes #14862
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user