summaryrefslogtreecommitdiffstats
path: root/hugolib/site.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib/site.go')
-rw-r--r--hugolib/site.go29
1 files changed, 28 insertions, 1 deletions
diff --git a/hugolib/site.go b/hugolib/site.go
index 624630d80..13d5482b1 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -31,6 +31,7 @@ import (
"time"
"github.com/gohugoio/hugo/common/types"
+ "github.com/gohugoio/hugo/modules"
"golang.org/x/text/unicode/norm"
"github.com/gohugoio/hugo/common/paths"
@@ -1333,6 +1334,32 @@ func (s *Site) initializeSiteInfo() error {
}
}
+ // Assemble dependencies to be used in hugo.Deps.
+ // TODO(bep) another reminder: We need to clean up this Site vs HugoSites construct.
+ var deps []*hugo.Dependency
+ var depFromMod func(m modules.Module) *hugo.Dependency
+ depFromMod = func(m modules.Module) *hugo.Dependency {
+ dep := &hugo.Dependency{
+ Path: m.Path(),
+ Version: m.Version(),
+ Time: m.Time(),
+ Vendor: m.Vendor(),
+ }
+
+ // These are pointers, but this all came from JSON so there's no recursive navigation,
+ // so just create new values.
+ if m.Replace() != nil {
+ dep.Replace = depFromMod(m.Replace())
+ }
+ if m.Owner() != nil {
+ dep.Owner = depFromMod(m.Owner())
+ }
+ return dep
+ }
+ for _, m := range s.Paths.AllModules {
+ deps = append(deps, depFromMod(m))
+ }
+
s.Info = &SiteInfo{
title: lang.GetString("title"),
Author: lang.GetStringMap("author"),
@@ -1351,7 +1378,7 @@ func (s *Site) initializeSiteInfo() error {
permalinks: permalinks,
owner: s.h,
s: s,
- hugoInfo: hugo.NewInfo(s.Cfg.GetString("environment")),
+ hugoInfo: hugo.NewInfo(s.Cfg.GetString("environment"), deps),
}
rssOutputFormat, found := s.outputFormats[page.KindHome].GetByName(output.RSSFormat.Name)