The embed is inside of the collection list, and represents a single record. So one way I do this is to create a JSON object like;
<script type="mydata">
{
"name": "<Name field embedded here>",
"raceFinish": "<Time field embedded here>",
"place": "<Place field embedded here>"
}
</script>
Then your script would find all type=“mydata” scripts, extract the innerText, JSON.parse it to an object, and add it to your array. At the end, you have an array of all of your CMS data, ready for your JS to use, sort, whatever.
This script block will be ignored by the browser for rendering purposes because it’s a script and the type is unknown.
Two things though.
- Webflow’s +add field in embeds HTML encodes the inserted data, which isn’t the same as JSON-encoding. Characters like a double-quote in your content could invalidate the JSON.
- A few CMS fields types cannot be embedded, like rich text fields.
I’ve built some libraries years ago to help with this, but they’re a bit ancient and dusty, I rarely need them on modern client projects. All of them are part of SA5 Data-
About SA5's Data Lib | SA5 | Sygnal Attributes | Designed for Webflow
Here’s a older doc that generates “tables” from datasources defined much like I’ve described above. This may still be fully supported in SA5 Data, you’d have to test it.
Collection List Data Source 📝 | SA5 | Sygnal Attributes | Designed for Webflow
At some point, I got annoyed with the HTML encoding problem regarding +Add field and designed a new spec to work around it, which I call HSON ( HTML Structured Object Notation ).
SA5 Data ( HSON ) ❺🧪 | SA5 | Sygnal Attributes | Designed for Webflow
The parser is fully implemented to convert HSON to JS objects. However I don’t think I integrated this directly into the SA5 Data’s database model as I’m rethinking the naming conventions for data-binding. A lot of reasons, including the need to access external data sources like RSS feeds in some cases.
In short there is a lot of stuff that could help you in your build, but you’re sorting through a series of 90% finished projects.
Fwiw, SA5 evolves driven by client project needs. If you need some dev help building this out, drop me a message and we’ll chat. I’d likely use HSON since it’s the easiest for you to manage in Webflow.