Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
I've used the shortcode from the supplied 'kfunctions.php' to place a YouTube video on a page. The video is shown OK but, regrettably, is not responsive.
Would very much appreciate some help to achieve a responsive video.

The relevant bits of code are as follows. First a template:-
Code: Select all
<cms:template title='Video'clonable='1'>
    <cms:editable
        name='video_content'
        label='Youtube'
        type='richtext'>   
        [youtube L_KrXGWpXgY /]   
    </cms:editable>
</cms:template> 


Then invoke the display of the video:-
Code: Select all
<cms:do_shortcodes><cms:show video_content /></cms:do_shortcodes>


Help please?
Hello Ken.

I presume the YouTube shortcode you have placed in your kfunctions.php comes from the following documentation page -
https://docs.couchcms.com/miscellaneous/shortcodes.html

If that is so, that shortcode assigns a class named 'youtube-player' to the outputted <IFRAME>; you can target that class with CSS to make the <IFRAME> responsive e.g. as follows -
Code: Select all
<style>
    .youtube-player {
        aspect-ratio: 16 / 9;
        width: 100%;
    }
</style>

Does this help? Please let me know.
Thanks KK, that does it, Much appreciated!
Ken
You are always welcome :)
4 posts Page 1 of 1