aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2023-05-20 15:04:22 +0200
committerBjørn Erik Pedersen <[email protected]>2023-05-20 17:45:56 +0200
commit7c7baa618325cb3d2b1ef48bdc1f97aae25f62e9 (patch)
treef80cd6e57e2f9dcb07ceae3e7c022f41d4076bfe /hugolib
parent4f085e80da9a415725db3def70e5ce847cf06741 (diff)
downloadhugo-7c7baa618325cb3d2b1ef48bdc1f97aae25f62e9.tar.gz
hugo-7c7baa618325cb3d2b1ef48bdc1f97aae25f62e9.zip
Add hugo.WorkingDir
Fixes #10969
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/config_test.go23
-rw-r--r--hugolib/site_new.go2
2 files changed, 24 insertions, 1 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go
index 24275025c..4af9b7998 100644
--- a/hugolib/config_test.go
+++ b/hugolib/config_test.go
@@ -898,6 +898,29 @@ mainSections: []
}
+func TestConfigHugoWorkingDir(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+-- layouts/index.html --
+WorkingDir: {{ hugo.WorkingDir }}|
+
+`
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ WorkingDir: "myworkingdir",
+ },
+ ).Build()
+
+ b.AssertFileContent("public/index.html", `
+WorkingDir: myworkingdir|
+`)
+
+}
+
func TestConfigMergeLanguageDeepEmptyLefSide(t *testing.T) {
t.Parallel()
diff --git a/hugolib/site_new.go b/hugolib/site_new.go
index b0b34e457..1262cc3ae 100644
--- a/hugolib/site_new.go
+++ b/hugolib/site_new.go
@@ -261,7 +261,7 @@ func newHugoSitesNew(cfg deps.DepsCfg, d *deps.Deps, sites []*Site) (*HugoSites,
dependencies = append(dependencies, depFromMod(m))
}
- h.hugoInfo = hugo.NewInfo(h.Configs.Base.Environment, dependencies)
+ h.hugoInfo = hugo.NewInfo(h.Configs.GetFirstLanguageConfig(), dependencies)
var prototype *deps.Deps
for i, s := range sites {