Last Updated on April 9, 2021 by amitoverflow1
In this post I will show you a short trick to include youtube videos to your blogger and wordpress posts.
There was a time when blogger didn’t allow uploading videos but with the recent update by blogger team now its quite easy to upload a video to blogger and use it your post. Now blogger also allows linking a video from youtube. You can find this option at the right hand top of your blogger edit post section.
WordPress free hosted blog on the other hand doesnt allow video uploading. If you are using free wordpress hosted blog then you wont get any option to upload video and include it in wordpress post. In that situation you can use your custom html code to include youtube videos to your post.
You can include youtube videos to a wordpress/blogger post using iframe code
If you are on free wordpress or google blogger, you can easily include youtube video to your blog post using HTML iframe tag. Iframe tag embeds youtube video in webpage with video player and the embedded video in your post will look something like the following :
Iframe code for youtube videos
Here is html iframe code you can just copy and paste to your blog post.
<iframe src="https://www.youtube.com/embed/lZ2p1gHQhVk"> </iframe>
The only thing you need to change in code above is video id that is at the end of the URL (www.youtube.com/embed/lZ2p1gHQhVk . You can replace it with your youtube video id which you can from youtube video share link that looks like https://youtu.be/lZ2p1gHQhVk just remove the youtube.be/ URL and copy the ID to use it in iframe code.
You can customize the height and width of video
You can adjust width and height of youtube video using height and width attributes in iframe code. The following embedded video has 300px height and 200px width :
Iframe code with height and width attributes :
<iframe src="https://www.youtube.com/embed/lZ2p1gHQhVk" width="200" height="300"> </iframe>
Isn’t it that simple? :).
Hope this article was helpful and thanks for reading !