Saving a entire partial's output instead a return value

Hi,
I thought I could use partials to return a block of text, but I realized I could not, because I want to return the text of the partial itself (after processing, of course).
To be more precise, I need to generate the following whenever certain links are encountered:

<input type="checkbox" id="{{$hash}}"/>
<dialog open>
 <form method="dialog"><span role=heading>{{partial "docs/title-menu.html" $page}}</span><button>X</button></form>
 <iframe role=article src="{{$destination}}" allowfullscreen allow-same-origin seamless></iframe>
 </dialog>

But to work input must be at the same level or higher on the DOM tree as the label element which will take place of the normal link, because I am NOT using javascript.
I had another method with spans instead of dialogs, but while it had the advantage of not disrupting paragraphs, the code was messier.
I can’t begin to imagine how to scram all that into arguments for printf. So I would love to store this in a Scratch variable to pour under my article tag. Something like:

{{ .Scratch.Add “list-dialogs” (partial dialog .) }}

thanks :wink:

Ah, I was wrong, I don’t in fact need partials at all: I just need to store a few variables, and produce the code in the base template.

<div class="post-ctt">
<h1>{{ .Title }}</h1>
{{ .Scratch.Set "list-dialogs" ( dict "Page" "" "Destination" "" "Hash" "" ) }}
{{.Content}}
{{with .Scratch.Get "list-dialogs" }}
	{{ range . }}
		<input type="checkbox" id="{{.hash}}"/>
		<dialog open role=article>
		<form method="dialog"><span role=heading>{{partial "docs/title-menu.html" .page}}</span><button>X</button></form>
		<iframe src="{{ print .destination "?iframe"}}" allowfullscreen allow-same-origin seamless></iframe>
		</dialog>
	{{ end }}
{{ end }}
</div>

But how do I get the correct elaboration order to populate the variable for sure ?
thanks