I’m reusing content in my Hugo site. I have a shortcode which includes a markdown fragment in a parent topic.
So I have parent.md (with front matter) and fragment.md (no front matter).
In parent.md, I call the fragment with my shortcode:
{{< snippet "fragment.md" >}}
where the content of the shortcode is:
{{- with .Site.GetPage (.Get 0) -}}
{{- .Content -}}
{{ end }}
My problem. In snippet.md, I call another shortcode which relies on the page parameters of parent.md.
Is there any way to retrieve the page parameters from parent.md?
It would be helpful if you provided a complete example.
Yeah, sorry about that.
I’ve created a repo which I hope illiustrates the problem I’m trying to solve.
In layouts/shortcodes/conditions.html, I’m trying to retrieve front matter from posts/my-first-post.md
The short answer is, “No.”
This is roughly what you are trying to do:

In this diagram, the last place that you have my-first-post in context is within the snippet shortcode.
You cannot pass additional context with the .GetPage method, nor can you leverage a page-level .Scratch or .Store because multiple origin pages could be trying to include the same fragment.
I encourage you to think through this and simplify your implementation. Even if you could access the origin page parameters from the final shortcode, the approach seems complicated and fragile.
Thanks @jmooring - that’s exactly what I’m trying to do. Unfortunately I can’t see any other reasonable way of accomplishing the goal - reusing a topic where the content varies in places.