Youtube Embed in Modx

My client want an option to post a video on his blog post.
He want an option to put youtube url to get the youtube embedded in his post.
Right now I have created a Tv with text are and he can post the url there.
but the problem is youtube embed code is like this -

<iframe width="560" height="315" src="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> 

you can see src, there is embed in url and in between the domain and main video code (Ti1LCuOt0nA)
so I just cant use Tv to paste url which is

One thing I can do is use a text area tv as youtube embed code and he can post the code there but he is little dumb on this stuff and he is going to use his mobile for posting blog on his site and youtube app has only share option in mobile, not embed option.

How can I make it like he just paste the url of the youtube video and post it and then the video embed automatically ?

Help please!!

I would use a MIGX TV for this, so your client can add the url and you can have it automatically placed in a template:

<iframe width="560" height="315" src="[[+url]]" frameborder="0" ...></iframe>

A few questions:
What text editor are you using? All the main ones have video insert buttons that you can configure so that the client uses that interface to add a video.
If your client is entering their blog posts on their phone, are they logging in to the manager or are you using a front end editor such as News Publisher? The manager is still pretty cumbersome on mobile…
For what it’s worth, I often just create a TV that just accepts the 11 digit YouTube video param, and teach my clients how to find and copy that from the URL. That way I can use the video ID in any markup I need for the site.

What is the benefit of using MIGX Tv instead of normal Tv here ? Sorry I am missing something. Please explain.

Currently I am providing him only manager interface and tinyMCE is the RTE im using.
And if there is no option for this then there will be only teaching him some technical stuffs you suggested here is the only option I saved for the last. :laughing:

TinyMCE has a video insert button. Should be configurable depending on which tinymce extra you’ve installed.
Or alternatively make a TV and teach them how to copy just the video id…

1 Like

Oh also there’s great video extra that might be everything you need, I’m blanking on the name but look in the extras for it.

Edit: it’s called “videobox”

1 Like

If there’s only ever one video added a regular TV is fine, but if your client wants to add multiple videos, then that’s the more future proof solution. If that’s not the case, then of course a regular TV is just fine.

But I think overall what lucy said seem to be the smarter way.

1 Like

ContentBlocks has a built-in video input that does exactly what you describe, but if that’s all you’re going to use it for that’s a bit of a heavy hammer…


Thank you everyone for the suggestions.
@lucy 's Videobox is the Extra what I was looking for.
Edit : here is simple call im using now. [[Videobox? &videos=[[*YoutubeUrlHdaLive]]]] with my text Tv for YouTube urls.

I got an idea that there are plenty of hidden/faded extras that we can find but just searching but they are powerful enough to do magic. So we should start a thread of these extras we know personally to share their name, purpose and if possible, an example code so one can find those quickly. A mega thread pinned on top.

What do you say @markh ? :wink:

With the relaunch of the documentation, there’s a list of commonly recommended extras on the overview here:

Obviously do share interesting extras (and a thread like this is now great for future MODXers to find out about ways insert youtube videos), but I personally have my doubts a megathread with everyone’s recommendarions on all possible topics is so much easier to search than the extras repository or a curated list in the docs. :wink:

1 Like

You are right but when I search for keywords, I get odd results. not the one I am looking for just like in case with Videobox. :smiley:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.