2015-12-10 17:19:38 -05:00
|
|
|
// 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.
|
|
|
|
|
2014-12-09 10:36:07 -05:00
|
|
|
package hugolib
|
|
|
|
|
2015-01-19 02:26:06 -05:00
|
|
|
import (
|
2015-03-18 07:23:13 -04:00
|
|
|
"fmt"
|
2015-01-19 02:26:06 -05:00
|
|
|
"html/template"
|
2016-04-07 10:05:23 -04:00
|
|
|
|
2017-06-13 12:42:45 -04:00
|
|
|
"github.com/gohugoio/hugo/helpers"
|
2015-01-19 02:26:06 -05:00
|
|
|
)
|
|
|
|
|
2014-12-09 10:36:07 -05:00
|
|
|
var (
|
2016-04-07 10:05:23 -04:00
|
|
|
// CommitHash contains the current Git revision. Use make to build to make
|
|
|
|
// sure this gets set.
|
2014-12-09 10:36:07 -05:00
|
|
|
CommitHash string
|
2016-04-07 10:05:23 -04:00
|
|
|
|
|
|
|
// BuildDate contains the date of the current build.
|
|
|
|
BuildDate string
|
2014-12-09 10:36:07 -05:00
|
|
|
)
|
|
|
|
|
2015-01-18 20:53:07 -05:00
|
|
|
var hugoInfo *HugoInfo
|
|
|
|
|
2015-01-18 20:40:34 -05:00
|
|
|
// HugoInfo contains information about the current Hugo environment
|
2014-12-09 10:36:07 -05:00
|
|
|
type HugoInfo struct {
|
|
|
|
Version string
|
2015-01-19 02:26:06 -05:00
|
|
|
Generator template.HTML
|
2014-12-09 10:36:07 -05:00
|
|
|
CommitHash string
|
|
|
|
BuildDate string
|
|
|
|
}
|
|
|
|
|
2015-01-18 21:06:07 -05:00
|
|
|
func init() {
|
|
|
|
hugoInfo = &HugoInfo{
|
2017-04-13 10:59:05 -04:00
|
|
|
Version: helpers.CurrentHugoVersion.String(),
|
2015-01-18 21:06:07 -05:00
|
|
|
CommitHash: CommitHash,
|
|
|
|
BuildDate: BuildDate,
|
2017-04-13 10:59:05 -04:00
|
|
|
Generator: template.HTML(fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, helpers.CurrentHugoVersion.String())),
|
2014-12-09 10:36:07 -05:00
|
|
|
}
|
|
|
|
}
|