Skip to main content

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.

Installation

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

$ pip install pelican-youtube

Then enable it in your pelicanconf.py

PLUGINS = [
    # ...
    'pelican_youtube',
    # ...
]

Usage

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="https://www.youtube.com/embed/VIDEO_ID" allowfullscreen seamless frameBorder="0"></iframe>
</div>

Additional arguments

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="https://www.youtube.com/embed/4_X6EyqXa2s"></iframe>
</div>

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="https://www.youtube.com/embed/4_X6EyqXa2s" seamless frameBorder="0"></iframe>
</div>

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.

License

MIT license.

Download files

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

Source Distribution

pelican_youtube-0.2.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

pelican_youtube-0.2.1-py2.py3-none-any.whl (8.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pelican_youtube-0.2.1.tar.gz.

File metadata

  • Download URL: pelican_youtube-0.2.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.3

File hashes

Hashes for pelican_youtube-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7588afa4bd5b0c54a1a1490f08156a58b12d8a73f7c417b56ec8c5d94026b48f
MD5 24b658db3368d9aabd75beb4f892d191
BLAKE2b-256 86d07a3557c7ec5656f65506f77343251db20bfcd7fbe5c9c6842540cdaf6282

See more details on using hashes here.

File details

Details for the file pelican_youtube-0.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: pelican_youtube-0.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.3

File hashes

Hashes for pelican_youtube-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 72145f827f0631f1a28734b257f436bb22e7d0f92ff9436572eabaee8c544136
MD5 be25a6041c5aae6a27d82b778c2bb3a1
BLAKE2b-256 15d625dfd69cba096e04f3fc55b1586492d3109a38e0cb0e14175567e50730ed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page