mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
d7798906d8
commit
8947c3fa0b
2 changed files with 6 additions and 2 deletions
|
@ -305,7 +305,7 @@ func (c *PageCollections) getContentNode(context page.Page, isReflink bool, ref
|
|||
}
|
||||
|
||||
// Ref/relref supports this potentially ambigous lookup.
|
||||
return getByName(name)
|
||||
return getByName(path.Base(name))
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1030,11 +1030,13 @@ func checkLinkCase(site *Site, link string, currentPage page.Page, relative bool
|
|||
}
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/6952
|
||||
func TestRefBundle(t *testing.T) {
|
||||
func TestRefIssues(t *testing.T) {
|
||||
b := newTestSitesBuilder(t)
|
||||
b.WithContent(
|
||||
"post/b1/index.md", "---\ntitle: pb1\n---\nRef: {{< ref \"b2\" >}}",
|
||||
"post/b2/index.md", "---\ntitle: pb2\n---\n",
|
||||
"post/nested-a/content-a.md", "---\ntitle: ca\n---\n{{< ref \"content-b\" >}}",
|
||||
"post/nested-b/content-b.md", "---\ntitle: ca\n---\n",
|
||||
)
|
||||
b.WithTemplates("index.html", `Home`)
|
||||
b.WithTemplates("_default/single.html", `Content: {{ .Content }}`)
|
||||
|
@ -1042,4 +1044,6 @@ func TestRefBundle(t *testing.T) {
|
|||
b.Build(BuildCfg{})
|
||||
|
||||
b.AssertFileContent("public/post/b1/index.html", `Content: <p>Ref: http://example.com/post/b2/</p>`)
|
||||
b.AssertFileContent("public/post/nested-a/content-a/index.html", `Content: http://example.com/post/nested-b/content-b/`)
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue