Multiple Vimeo embeds

I am currently working on a simple portfolio website which should display a mix of images and vimeo videos per project.
Since the amount of videos per project varies every time, I wonder if there is a smart way to let the client post a list of vimeo links in one textarea (panel) and convert them into vimeo embeds.

The amount of vimeo embeds should be unlimited. Any idea how to solve this? I’m having trouble thinking of a way that will give me an option to work with any number between 0-10 videos per project.


If you want to handle the list of videos in your template, a structure field would be your best bet:

Edit: There also the vimeo kirbytag, that can be used right in a text field and is converted to an embed automatically:

Thanks, the structure field seems like a good option. How can I fetch each Yaml object though?

Currently trying something like:

<?php foreach($project->vimeolinks()-> as $vimeovid): ?>
<?php echo vimeo('<?php echo $vimeovid ?>') ?>
<?php endforeach ?>

You can use either the yaml() or the toStructure() methods:

<?php foreach($project->vimeolinks()->toStructure() as $vimeovid): ?>
<?php echo vimeo($vimeovid->vimeoid()) ?>
<?php endforeach ?>
<?php foreach($project->vimeolinks()->yaml() as $vimeovid): ?>
<?php echo vimeo($vimeovid['vimeoid']) ?>
<?php endforeach ?>

Supposed, your field inside the structure field is called “vimeoid”.

1 Like

Works perfectly. Thanks alot!