diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-07-27 10:03:45 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-09-06 18:32:16 +0300 |
commit | 5b9c2a40f180587de037122e3cd9ac0f3ce64f5e (patch) | |
tree | 6dd2edef8e6d75e2f57679d00100756c0af7fc27 /hugolib/hugo_info.go | |
parent | 3a02807970e792299a80738befe32eea8d10984d (diff) |
Move HugoSites to hugolib
It will get more involved in the build process in a minute.
See #2309
Diffstat (limited to 'hugolib/hugo_info.go')
-rw-r--r-- | hugolib/hugo_info.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/hugolib/hugo_info.go b/hugolib/hugo_info.go new file mode 100644 index 000000000..77bf54802 --- /dev/null +++ b/hugolib/hugo_info.go @@ -0,0 +1,49 @@ +// Copyright 2015 The Hugo Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package hugolib + +import ( + "fmt" + "html/template" + + "github.com/spf13/hugo/helpers" +) + +var ( + // CommitHash contains the current Git revision. Use make to build to make + // sure this gets set. + CommitHash string + + // BuildDate contains the date of the current build. + BuildDate string +) + +var hugoInfo *HugoInfo + +// HugoInfo contains information about the current Hugo environment +type HugoInfo struct { + Version string + Generator template.HTML + CommitHash string + BuildDate string +} + +func init() { + hugoInfo = &HugoInfo{ + Version: helpers.HugoVersion(), + CommitHash: CommitHash, + BuildDate: BuildDate, + Generator: template.HTML(fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, helpers.HugoVersion())), + } +} |