Closed bep closed 3 weeks ago
I had a head scratching moment investigating a bug in the wild.
Here's a failing test:
func TestRenderShortcodesIncludeShortRefEdit(t *testing.T) { t.Parallel() files := ` -- hugo.toml -- disableLiveReload = true disableKinds = ["home", "taxonomy", "term", "section", "rss", "sitemap", "robotsTXT", "404"] -- content/first/p1.md -- --- title: "p1" --- ## p1-h1 {{% include "p2" %}} -- content/second/p2.md -- --- title: "p2" --- ### p2-h1 -- layouts/shortcodes/include.html -- {{ $p := site.GetPage (.Get 0) -}} {{ $p.RenderShortcodes -}} -- layouts/_default/single.html -- {{ .Content }} ` b := TestRunning(t, files) b.AssertFileContentEquals("public/first/p1/index.html", "<h2 id=\"p1-h1\">p1-h1</h2>\n<p></p>\n<h3 id=\"p2-h1\">p2-h1</h3>\n<p></p>\n") b.EditFileReplaceAll("content/second/p2.md", "p2-h1", "p2-h1-edited").Build() b.AssertFileContentEquals("public/first/p1/index.html", "<h2 id=\"p1-h1\">p1-h1</h2>\n<p></p>\n<h3 id=\"p2-h1-edited\">p2-h1-edited</h3>\n<p></p>\n") }
The above test passes if you use the full path to the content file to include:
{{% include "second/p2" %}}
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I had a head scratching moment investigating a bug in the wild.
Here's a failing test:
The above test passes if you use the full path to the content file to include: