All Projects → kura → pelican_youtube

kura / pelican_youtube

Licence: MIT license
YouTube directives for the Pelican static site generator.

Programming Languages

python
139335 projects - #7 most used programming language
CSS
56736 projects
Makefile
30231 projects

Projects that are alternatives of or similar to pelican youtube

pelican-alchemy
A ✨ functional, clean, responsive Pelican theme
Stars: ✭ 129 (+416%)
Mutual labels:  pelican
iKevinY.github.io
Repository for my Pelican-powered website.
Stars: ✭ 21 (-16%)
Mutual labels:  pelican
Fullstackpython.com
Full Stack Python source with Pelican, Bootstrap and Markdown.
Stars: ✭ 2,667 (+10568%)
Mutual labels:  pelican
Pelican
Static site generator that supports Markdown and reST syntax. Powered by Python.
Stars: ✭ 10,699 (+42696%)
Mutual labels:  pelican
eevee
A Material Design theme for the Pelican static site generator.
Stars: ✭ 37 (+48%)
Mutual labels:  pelican
pneumatic
Minimalistic, responsive Pelican theme.
Stars: ✭ 52 (+108%)
Mutual labels:  pelican
plumage
🎨 Theme for Pelican, the static site generator.
Stars: ✭ 50 (+100%)
Mutual labels:  pelican
pelican-encrypt-content
a pelican plugin to password protect content
Stars: ✭ 22 (-12%)
Mutual labels:  pelican
taman
Pelican theme with "just the right amount"
Stars: ✭ 14 (-44%)
Mutual labels:  pelican

Pelican YouTube

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

Installation

Pip

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

$ pip install pelican-youtube

Then enable it in your pelicanconf.py

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

Local plugins directory

$ mkdir plugins
$ git clone [email protected]:kura/pelican_youtube.git plugins/pelican_youtube

Then enable it in your pelicanconf.py

PLUGIN_PATHS = ["plugins/"]
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>

Note

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.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].