I’m trying to achieve something similar and you got me started on the process.
Unfortunately, after some testing and some browsing in the SilverBullet code base. It seems to be by design that the exposed syscall to render a template keeps the full frontmatter from the template instead of keeping only the content from the “child” frontmatter.
As you can see here, a renderTemplate function (different one, unavailable to space-script) uses the template.renderTemplate syscall. However, it does some other operations to extract the frontmatter “child” object before rendering the template using the syscall function.
@zef Would it be possible to expose a different template rendering syscall that process the frontmatter in the same way as Page: From Template
does? Manually doing that processing in space-script would work but it seems counterproductive as the required functions already exist in the code base. I’d love to contribute but I’m not proficient in java script unfortunately.
EDIT: I just saw that space-lua seems to be progressing well. So maybe it is something to be included in the Lua API instead?