mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
ac6b86aff8
commit
73d923e95d
3 changed files with 14 additions and 11 deletions
|
@ -7,7 +7,7 @@ var (
|
||||||
BuildDate string
|
BuildDate string
|
||||||
)
|
)
|
||||||
|
|
||||||
// Hugo contains all the information about the current Hugo environment
|
// HugoInfo contains information about the current Hugo environment
|
||||||
type HugoInfo struct {
|
type HugoInfo struct {
|
||||||
Version string
|
Version string
|
||||||
Generator string
|
Generator string
|
||||||
|
@ -15,8 +15,8 @@ type HugoInfo struct {
|
||||||
BuildDate string
|
BuildDate string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHugoInfo() HugoInfo {
|
func newHugoInfo() *HugoInfo {
|
||||||
return HugoInfo{
|
return &HugoInfo{
|
||||||
Version: Version,
|
Version: Version,
|
||||||
CommitHash: CommitHash,
|
CommitHash: CommitHash,
|
||||||
BuildDate: BuildDate,
|
BuildDate: BuildDate,
|
||||||
|
|
|
@ -29,7 +29,7 @@ type Node struct {
|
||||||
Params map[string]interface{}
|
Params map[string]interface{}
|
||||||
Date time.Time
|
Date time.Time
|
||||||
Sitemap Sitemap
|
Sitemap Sitemap
|
||||||
Hugo *HugoInfo
|
hugo *HugoInfo
|
||||||
UrlPath
|
UrlPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,13 @@ func (n *Node) IsMenuCurrent(menuId string, inme *MenuEntry) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *Node) Hugo() *HugoInfo {
|
||||||
|
if n.hugo == nil {
|
||||||
|
n.hugo = newHugoInfo()
|
||||||
|
}
|
||||||
|
return n.hugo
|
||||||
|
}
|
||||||
|
|
||||||
func (n *Node) isSameAsDescendantMenu(inme *MenuEntry, parent *MenuEntry) bool {
|
func (n *Node) isSameAsDescendantMenu(inme *MenuEntry, parent *MenuEntry) bool {
|
||||||
if parent.HasChildren() {
|
if parent.HasChildren() {
|
||||||
for _, child := range parent.Children {
|
for _, child := range parent.Children {
|
||||||
|
|
|
@ -67,7 +67,6 @@ type Site struct {
|
||||||
Taxonomies TaxonomyList
|
Taxonomies TaxonomyList
|
||||||
Source source.Input
|
Source source.Input
|
||||||
Sections Taxonomy
|
Sections Taxonomy
|
||||||
Hugo HugoInfo
|
|
||||||
Info SiteInfo
|
Info SiteInfo
|
||||||
Shortcodes map[string]ShortcodeFunc
|
Shortcodes map[string]ShortcodeFunc
|
||||||
Menus Menus
|
Menus Menus
|
||||||
|
@ -341,7 +340,6 @@ func (s *Site) initialize() (err error) {
|
||||||
|
|
||||||
s.Menus = Menus{}
|
s.Menus = Menus{}
|
||||||
|
|
||||||
s.Hugo = NewHugoInfo()
|
|
||||||
s.initializeSiteInfo()
|
s.initializeSiteInfo()
|
||||||
|
|
||||||
s.Shortcodes = make(map[string]ShortcodeFunc)
|
s.Shortcodes = make(map[string]ShortcodeFunc)
|
||||||
|
@ -369,7 +367,6 @@ func (s *Site) initializeSiteInfo() {
|
||||||
Menus: &s.Menus,
|
Menus: &s.Menus,
|
||||||
Params: params,
|
Params: params,
|
||||||
Permalinks: permalinks,
|
Permalinks: permalinks,
|
||||||
Hugo: &s.Hugo,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,10 +728,10 @@ func (s *Site) assembleSections() {
|
||||||
|
|
||||||
for i, wp := range s.Sections[k] {
|
for i, wp := range s.Sections[k] {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
wp.Page.NextInSection = s.Sections[k][i - 1].Page;
|
wp.Page.NextInSection = s.Sections[k][i-1].Page
|
||||||
}
|
}
|
||||||
if i < len(s.Sections[k])-1 {
|
if i < len(s.Sections[k])-1 {
|
||||||
wp.Page.PrevInSection = s.Sections[k][i + 1].Page;
|
wp.Page.PrevInSection = s.Sections[k][i+1].Page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1194,7 +1191,6 @@ func (s *Site) NewNode() *Node {
|
||||||
return &Node{
|
return &Node{
|
||||||
Data: make(map[string]interface{}),
|
Data: make(map[string]interface{}),
|
||||||
Site: &s.Info,
|
Site: &s.Info,
|
||||||
Hugo: &s.Hugo,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue