Variables in CMS Display

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

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 : Collection list | Webflow University

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 : Overview dynamic content | Webflow University

1 Like

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.

@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…

Collection list. I’ll look into collection page.

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

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

Thanks!

Just use the display settings :

Display block

Display inline

1 Like