Create a custom variable from a Collection Field?

Hello. I have a question about how to do this. I have a field in my collection called ‘name’ that I would like to set as a variable for use in my page.

This variable would be used to do something like this:

Product Name: @fieldName

@fieldName is a new blah blah blah.

Can this be done? I sure hope so!

Here is my site Read-Only: LINK
(how to share your site Read-Only link)

Hey Todd, yes.

For very small, isolated scenarios you’d just use HTML Embeds or creative layouts to mix CMS-bound content with static content.

But if you do this a lot, or you need to perform calculations on your CMS data, or bind form elements to your CMS data, etc, you can use SA5’s data and data-binding features.

For collection list data, you’d define data sources from your collection lists using HTML Embeds like this;

And then you can access that data as JSON objects in your script, or bind them to elements using the [wfu-bind] attribute.

Template-binding is supported as well, but the docs are not yet written. Basically you can use macros like {{ $ }} to inject your CMS fields into text and richtext elements.

{{ $data.fieldName}} is a new blah blah blah

As I said though, the binding portion of the docs is in progress. We built a LOT on this feature recently and have a lot of documentation to update.

Here’s where you can start-

But if you’re keen to use it, jump over to the SA5 forums and reply on this thread. I’ll help you get it integrated.

1 Like

Thank you for sharing this! I will review it and see if I can get this to work for my page.