Panel field type for video

Hello Kirby Community!

I am quite new to Kirby and in the process of adding a video to my page. I want to enable my content editors to add a video without touching the template files.

The way Kirby integrates images into blueprints is very convenient and I was quite disappointed that there is no ‘video’ or ‘file’ equivalent.

Have I missed something? Or can you point me into a direction to achieve a similar functionality for video as Kirby offers it for images?

Thank you

Hi @0xSven, unfortunately, there is no dedicated video field. You could just use a standard text field or create a custom Panel field yourself.

You could also use a select field like this:

    label: Video
    type: select
    options: videos

Not as visual and without drag and drop support, but it works out of the box. Alternatively you could copy the image field to your site/fields directory, rename it video and modify it to load videos instead of image files.

Thank’s for the replies!

I like the select field for now. If I find some time I will build the custom field later!

Quick follow up question: How would I get to the URL of the video? I tried several ways but wasn’t successful.

Ways that don’t work:

$video = $data->myVideo()->toFile(); $video->url();

What is $data in your example? Is that code on a one pager?

It’s the data of a snippet on a one-pager:

<?php foreach($page->children() as $slide): ?>
<?php snippet('slide', array('data' => $slide)) ?>
<?php endforeach ?>

This should then work:



$video = $data->myVideo()->toFile();
echo $video->url()


I had another problem though: There were several slides without the video and those broke the website!

Thank you all! I am happy :slight_smile:

You should always use an if statement to check if the video exists before trying to output an URL (in fact, not only where videos are concerned, but in general check if an object exists before you try to do anything with it)

Just as a side info:

If YouTube or Vimeo is an option, have a look at the oEmbed Plugin by @distantnative

1 Like

You can use fanningert/kirbycms-extension-video, if you want to show your own (local) videos.
I use “ffmpeg” to convert video to the needed file-versions.

Good luck!

@anon77445132 AFAIK, this extension does not come with a Panel field for video, which is what @0xSven is after.