{% if include.media_url contains "https://youtu.be/" %} {% assign media_url = include.media_url | replace: 'https://youtu.be/','https://youtube.com/embed/'%} {% elsif include.media_url contains "https://www.youtube.com/watch?v="%} {% assign media_url = include.media_url | replace: 'https://www.youtube.com/watch?v=','https://youtube.com/embed/'%} {% else %} {% assign media_url = include.media_url%} {% endif %}