Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Easily embed YouTube videos in your posts

Project description

Pelican YouTube is a plugin to enabled you to embed YouTube videos in your pages and articles.


To install pelican-youtube, simply install it from PyPI:

$ pip install pelican-youtube

Then enable it in your

    # ...
    # ...


In your article or page, you simply need to add a line to embed your video.

.. youtube:: VIDEO_ID

Which will result in:

<div class="youtube youtube-16x9">
<iframe src="" allowfullscreen seamless frameBorder="0"></iframe>


This code will render you a fully responsive YouTube video, spanning the whole available container width. Note that you will need to integrate the code from youtube.css in your project or template style sheet. Alternatively, you can specify width and height as detailed below.

Attribute default  
allowfullscreen yes allow video to be displayed full-screen
seamless yes no borders around iframe
class youtube-16x9 additional CSS classes, usually for responsive behavior
  empty° (° when width or height are specified)
width, height empty video dimensions when responsive design is not desired

Example 1: (responsive design)

.. youtube:: 4_X6EyqXa2s
    :class: youtube-4x3
    :allowfullscreen: no
    :seamless: no

Will result in:

<div class="youtube youtube-4x3">
<iframe src=""></iframe>

Example 2: (non-responsive design)

.. youtube:: 4_X6EyqXa2s
    :width: 800
    :height: 500
    :allowfullscreen: no

Will result in:

<div class="youtube">
<iframe width="800" height="500" src="" seamless frameBorder="0"></iframe>

More Control of YouTube Video Player

YouTube offers more control via player parameters, which you simply attach to the VIDEO_ID as query parameters. See YouTube documentation for a list of possible parameters.

Example: (start video at time 00:20, start playing automatically, don’t show related content at end of video)

.. youtube:: 4_X6EyqXa2s?start=20&amp;autoplay=1&amp;rel=0

Known Issues

The presence of the frameBorder attribute causes an HTML5 validation error. Unfortunately, this attribute is still necessary for supporting older versions of Internet Explorer.


MIT license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pelican_youtube-0.2.0-py2.py3-none-any.whl (7.9 kB) Copy SHA256 hash SHA256 Wheel py2.py3
pelican_youtube-0.2.0.tar.gz (4.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page