diff options
Diffstat (limited to 'hugolib/hugo.go')
-rw-r--r-- | hugolib/hugo.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/hugolib/hugo.go b/hugolib/hugo.go index 24b09b2ee..3e4d02039 100644 --- a/hugolib/hugo.go +++ b/hugolib/hugo.go @@ -7,6 +7,8 @@ var ( BuildDate string ) +var hugoInfo *HugoInfo + // HugoInfo contains information about the current Hugo environment type HugoInfo struct { Version string @@ -15,11 +17,14 @@ type HugoInfo struct { BuildDate string } -func newHugoInfo() *HugoInfo { - return &HugoInfo{ - Version: Version, - CommitHash: CommitHash, - BuildDate: BuildDate, - Generator: `<meta name="generator" content="Hugo ` + Version + `" />`, +func getHugoInfo() *HugoInfo { + if hugoInfo == nil { + hugoInfo = &HugoInfo{ + Version: Version, + CommitHash: CommitHash, + BuildDate: BuildDate, + Generator: `<meta name="generator" content="Hugo ` + Version + `" />`, + } } + return hugoInfo } |