Join the Webstudio community

Updated 3 months ago

HTML video in collection

At a glance
Any chance I can use data from collection as video source?

As webflow user I am not familiar with custom cms, json and all that stuff. Can you please help to figure it out?
Attachment
adadg.jpg
1
J
b
c
17 comments
you need to use template literals so surround your entire code with two backticks

Plain Text
` ${vars in here} `
then use ${} and in there you can access vars
so roughly

Plain Text
`<video><source src="${cmsdata.myvid.src}"></video>`
Still cannot get it work.

I use code embed inside collection item with HTML video element. Inside src attribute I need to pase something like "${cmsdata.myvid.src}"? Where I need to use backticks?
Use backticks around the entire text. It says, "Im going to be mixing static and dynamic text. Everything inside will be considered static until I run into ${}"
"then whatever is inside ${}, I'll treat as a varaible and replace it with whatever the variable represents" in this case your video src
That's what I'm getting on the page. Seems like I'm doing something wrong
Attachment
image.png
Here is the code
Attachment
image.png
Oh you need to add that to the expression editor not the code field itself
Click the plus in the top left of the field
Wooow that worked! I didn't notice that small button at first. Thank you!
if you dont mind can you share the page link to see what you did with it.
  1. create new project
  2. add that specific thing that you can't make to work
  3. share a link
wow good work @beer_valera nice work, smooth
Add a reply
Sign up and join the conversation on Discord