Streaming live at 10am (PST)

Variables in CMS Display


#1

Hello Webflow Community,

I have created a CMS Collection of session summaries for my Dungeons & Dragons game. Each has a number of fields, but the ones I’m concerned with at the moment are “number” and “title”. I know I can bind, for example, title, to a Heading. What I’d like to do is say something like “Session $number, ‘$title’” on a Heading line of its own.

Is this possible with Webflow?

Thank you,
Scott


#2

Yup easy, you just type your sentence in a text field, double click on the part $number and create a span from the contextual mini menu bar that will appear. Then you just bind it with the wheel and select the corresponding field. This means in a single sentence you can have a mix of static text and two variables for instance. You can do that either in a collection page or in a collection list : https://university.webflow.com/article/collection-list

If you want to do that in code, works as well : just add an embed component (webflow’s code element) and then if you are in a collection page or a collection list you just add from the plus sign the field you want from the corresponding item in your CMS. > dynamic embeds : https://university.webflow.com/article/how-to-use-dynamic-embeds-on-your-webflow-site


#3

Thanks, @pepperclip. I am able to add the span, but I’m not seeing where to bind the collection element to it. The gear/wheel in the right-hand tool bar doesn’t show collection element options.


#4

@zanguine are you in a collection page or a collection list ?

If not, webflow has no way of knowing that it should drag in CMS info for you to bind…


#5

Collection list. I’ll look into collection page.


#6

Ahhhh… Ok so I tried again to understand the issue :slight_smile:

And, it might not be intuitive but you just need to wrap your element in a div, and then add separate text elements inside that you display inline (so that they behave like in a sentence). Each should have a specific wheel like in the screenshot attached :

20

Then you can just bind what you need to variables and have static text all in the same sentence


#7

I see. Now, the challenge is how to get the parts of the sentence to display inline instead of vertically.

Thanks!


#8

Just use the display settings :

Display block

Display inline