Skip to content

Add assets function to page#175

Open
yadunut wants to merge 1 commit into
kristoff-it:mainfrom
yadunut:page-assets
Open

Add assets function to page#175
yadunut wants to merge 1 commit into
kristoff-it:mainfrom
yadunut:page-assets

Conversation

@yadunut

@yadunut yadunut commented Aug 22, 2025

Copy link
Copy Markdown

I added a function to get the list of assets that belong to a page. I didn't see something that could do this in the docs but the documentation in superhtml seems to reference .assets.

I was using this to automatically insert images I had in a folder into a page. I realized I might be able do something similar by generating a JSON/ziggy file with the image paths using a zig build step(maybe, I haven't tried this yet) so I'm unsure if this PR is warranted but I hope it might be useful to somebody.

This is my first time writing some proper Zig code, so would love any critiques.

Use Case

<div :loop="$page.assets()">
  <img src="$loop.it.link()" alt="Page asset">
</div>

This allows for dynamic gallery generation without maintaining separate asset lists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant