summaryrefslogtreecommitdiffstats
path: root/hugolib/hugo_modules_test.go
diff options
context:
space:
mode:
authorDavid Karlsson <35727626+dvdksn@users.noreply.github.com>2023-07-15 11:13:08 +0200
committerGitHub <noreply@github.com>2023-07-15 11:13:08 +0200
commit286821e360e13b3a174854914c9cedd437bdd25e (patch)
tree5699a44ade0f60165394340916c6d84b9b352bf8 /hugolib/hugo_modules_test.go
parent79f15be5b0e47a788f62e50ba3e354c247a65f6b (diff)
Fix for data mounts in sub folders
Before this change, data files from Hugo modules were always mounted at the root of the `data` directory. The File and FileMetaInfo structs for modules are different from 'native' data directories. This changes how the keyParts for data files are generated so that data from modules or native directories are treated the same.
Diffstat (limited to 'hugolib/hugo_modules_test.go')
-rw-r--r--hugolib/hugo_modules_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/hugolib/hugo_modules_test.go b/hugolib/hugo_modules_test.go
index 3353f508e..88a0c3ec6 100644
--- a/hugolib/hugo_modules_test.go
+++ b/hugolib/hugo_modules_test.go
@@ -1178,3 +1178,32 @@ target = "content/resources-b"
b.AssertFileContent("public/resources-a/subdir/about/index.html", "Single")
b.AssertFileContent("public/resources-b/subdir/about/index.html", "Single")
}
+
+func TestMountData(t *testing.T) {
+ files := `
+-- hugo.toml --
+baseURL = 'https://example.org/'
+disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
+
+[[module.mounts]]
+source = "data"
+target = "data"
+
+[[module.mounts]]
+source = "extra-data"
+target = "data/extra"
+-- extra-data/test.yaml --
+message: Hugo Rocks
+-- layouts/index.html --
+{{ site.Data.extra.test.message }}
+`
+
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ },
+ ).Build()
+
+ b.AssertFileContent("public/index.html", "Hugo Rocks")
+}