From 4d425a86f5c03a5cca27d4e0f99d61acbb938d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 12 Apr 2019 10:26:10 +0200 Subject: [PATCH] Fix --- hugolib/shortcode_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index f1603eeeb..52b21649e 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -895,6 +895,37 @@ C-%s` } +// https://github.com/gohugoio/hugo/issues/5833 +func TestShortcodeParentResources(t *testing.T) { + t.Parallel() + + b := newTestSitesBuilder(t).WithSimpleConfigFile() + b.WithTemplatesAdded("shortcodes/c.html", ` +{{ range .Page.Parent.Resources }} +* {{ .Name }}: {{ .RelPermalink }} +{{ end }} +`) + + b.WithContent("b1/index.md", ` +--- +title: MyPage +--- + +{{< c >}} + +`, + "b1/logo.png", "PNG logo", + ) + + b.Build(BuildCfg{}) + + b.AssertFileContent("public/index.html", + "List Content:

Logo:P1:|P2:logo.png/PNG logo|:P1: P1:|P2:docs1p1/

C-s1p1

\n|", + "BP1:P1:|P2:docbp1/

C-bp1

", + ) + +} + func TestShortcodePreserveOrder(t *testing.T) { t.Parallel() assert := require.New(t)