mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-27 11:52:05 +00:00
parent
109e6f95fd
commit
724357a242
2 changed files with 12 additions and 11 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ type Node struct {
|
|||
Params map[string]interface{}
|
||||
Date time.Time
|
||||
Sitemap Sitemap
|
||||
hugo *HugoInfo
|
||||
UrlPath
|
||||
}
|
||||
|
||||
|
@ -79,10 +78,7 @@ func (n *Node) IsMenuCurrent(menuId string, inme *MenuEntry) bool {
|
|||
}
|
||||
|
||||
func (n *Node) Hugo() *HugoInfo {
|
||||
if n.hugo == nil {
|
||||
n.hugo = newHugoInfo()
|
||||
}
|
||||
return n.hugo
|
||||
return getHugoInfo()
|
||||
}
|
||||
|
||||
func (n *Node) isSameAsDescendantMenu(inme *MenuEntry, parent *MenuEntry) bool {
|
||||
|
|
Loading…
Reference in a new issue