summaryrefslogtreecommitdiffstats
path: root/hugolib/content_factory_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-11-08 11:50:51 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-11-08 14:10:46 +0100
commit2b01c85d14102353015cf6860d30be3d92964495 (patch)
treede5dbb36e0dcb6478d920af8ae94884d6571af06 /hugolib/content_factory_test.go
parentc09f5c5fd35c03de0444928ada3ce1c5a214b321 (diff)
Fix path resolution in hugo new
With theme and project with content directories and command on the form `hugo new posts/test.md`. Fixes #9129
Diffstat (limited to 'hugolib/content_factory_test.go')
-rw-r--r--hugolib/content_factory_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/hugolib/content_factory_test.go b/hugolib/content_factory_test.go
index 50cc783f6..dc3b4fc91 100644
--- a/hugolib/content_factory_test.go
+++ b/hugolib/content_factory_test.go
@@ -57,4 +57,22 @@ Hello World.
b.Assert(buf.String(), qt.Contains, `title: "Mypage"`)
})
+ // Issue #9129
+ c.Run("Content in both project and theme", func(c *qt.C) {
+ b := newTestSitesBuilder(c)
+ b.WithConfigFile("toml", `
+theme = 'ipsum'
+`)
+
+ themeDir := filepath.Join("themes", "ipsum")
+ b.WithSourceFile("content/posts/foo.txt", `Hello.`)
+ b.WithSourceFile(filepath.Join(themeDir, "content/posts/foo.txt"), `Hello.`)
+ b.CreateSites()
+ cf := NewContentFactory(b.H)
+ abs, err := cf.CreateContentPlaceHolder(filepath.FromSlash("posts/test.md"))
+ b.Assert(err, qt.IsNil)
+ b.Assert(abs, qt.Equals, filepath.FromSlash("content/posts/test.md"))
+
+ })
+
}