Embed v3 – easily embed your media sources!

Embed (formerly known as the oEmbed plugin) has arrived in version 3. Besides the rename, most changes happened under the hood in the library (oscarotero/Embed) that the plugin is based on.

Embed your media!

After installing the plugin, you can easily turn any field with a media url into embed code by just applying the field method to it:

<?= $page->tweet()->embed(); ?>

Or you use the Kirbytext tag:

(embed: https://vimeo.com/43444347)

Embed also comes with its own panel field which offers instant preview of the embedded media. A quick sneak peak:

Due to my current job, I cannot invest a lot of time into my plugins, but I try to keep them updated steadily. I hope you enjoy it - suggestions always welcome!

Documentation & Download


How could I implement a way to do multiple vimeo embeds through the panel?

You can either use multiple embed tags in a textarea field, or use a structure field (or multi-select field), depending on use case.

Structure field is most appropriate for this case. Say if I have a blueprint like this:

    label: Vimeo Links
    type: structure
    entry: >
      {{vimeovid}}<br />
        label: Vimeo
        type: text

How do I use the ->embed() tag with it?

Should be like in the readme, only within a loop:

$entries = $page->vimeolinks()->structure();
foreach($entries as $entry) 
  echo $entry->vimeovid()->embed();

(not tested)

1 Like

Sadly, it doesn’t work in production for me at all - I checked the requirements, which are all met (cURL, PHP version, …) - at first I thought this only affects Soundcloud, but YouTube and others, too - any idea on how to debug this?

Greatly appreciated!

Anything in your console?

Nothing, and nothing in Apache and PHP error logs either …

So, what I see in the screenshot is what you get in your website? Meaning: the kirbytag is not rendered at all?

That’s true, nothing to see here. I mean, I could try to use the template tag, but for my client that would be a nightmare …

// Edit:
There’s also a github issue stating that it doesn’t work for them in production, but no answer by @distantnative so far - which I can totally understand, given his many contributions to the open source world AND means to earn money :wink:

I’ll try older versions and check if they lead somewhere.

But if it does not get rendered, I’d assume that the plugin is missing. Otherwise, you would see some results, even if there are no videos.

Alright, after long time playing with it, here goes: there was no cache directory present. Eventually when using other template methods to invoke the plugin, Whoops complained.


Ah, yes, is that issue mentioned in the plugin docs?

Searching for ‘cache’ returns only a commit title - so no …

So now stuff gets rendered, but clicking the play button (<img>) doesn’t work - will this never end!

With a nick like yours, it’s probably your fate to spend your day debugging…so no.

1 Like

First of all, I like this plugin, thank you very much!
Second, I don’t get it to run, just like @daybugging everything works (including backend preview), but hitting ‘PLAY’ doesn’t do anything.

Is the cache folder writable?

Found out what it was, eventually - since lazyload is activated by default, the <iframe> sets the URL as data-src - not including embed’s JS leads to not being able to play it.

But thanks for asking.

1 Like

That solved it for me, too … thx for sharing