Closed jernst closed 4 years ago
Wat exactly do you mean by "constant"?
"constant" as in: the result of the shortcode is constant regardless of its "environment". So the value does not depend on .Inner or the page context or the front matter or whatever.
use case: I have some text in my .md file (like a comment, or something that isn't entirely baked yet) that I don't want to show on the site, but keep in the .md file. In my example above, regardless of content, it would evaluate to "XXX".
I suspect this is a duplicate of https://github.com/gohugoio/hugo/issues/6857.
layouts/shortcodes/foo.html
foo
content/post/bar.md
{{< foo >}}{{< /foo >}}
layouts/shortcodes/foo.html
foo
content/post/bar.md
{{< foo >}}
layouts/shortcodes/foo.html
{{ $noop := .Inner }}
foo
content/post/bar.md
{{< foo >}}{{< /foo >}}
To reliably reproduce you should run hugo
after making changes. If you make changes while running hugo server
the error may not occur.
OK, but note that the above is supposed to fail (but not crash).
Whis is "the above supposed to fail"? I'd like to be able to use this construct to "comment out" some text, among other use cases. Or am I misunderstanding?
Any closing shortcode needs a .Inner
reference (which is partly how we identify it as such).
You can do what you want if you just add $foo := .Inner
or something in the shortcode template.
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.
What version of Hugo are you using (
hugo version
)?From brew.
Does this issue reproduce with the latest release?
Yes.
Steps to reproduce
XXX
Workaround
Then it works.
Stack trace