Embed hosted video in Jekyll with an include

Updated: December 1, 2026

You publish several videos on a Jekyll site and want to reuse the same player markup. Put the iframe in an _includes file and pass its address and title from each post. Then check the built site to make sure each page shows the right clip.

Prepare one recording per post

Imagine a photography blog with posts on leveling a camera and positioning a reflector. Upload both approved clips to Dembed. When they are ready, open Embed and copy their HTTPS /embed/ addresses from src. Keep each /v/ link so you can add a visible link next to its player.

Create the include and pass its values

Save the first snippet as _includes/hosted-video.html. Jekyll makes the src and title parameters available to that file. Use the second snippet in the Markdown post and replace v_EJEMPLO with the real clip ID. Give every iframe a title that describes the action. Use embed URLs supplied by an approved host.

Keep the two snippets in separate files. If you later change the width in the include, test both posts again. Update a post’s watch link when you change its iframe address. To check the change, write down the two expected addresses and look for each in its post’s built HTML. A second check on the published website confirms that build is live and that the browser can display the player.

<iframe src="{{ include.src | escape }}"
  title="{{ include.title | escape }}" loading="lazy" allowfullscreen
  style="width:100%;aspect-ratio:16/9;border:0"></iframe>

Call the include from a post

{% include hosted-video.html src="https://dembed.cc/embed/v_EJEMPLO" title="Level the camera" %}

Check the built HTML on two posts

Build the site using your normal project workflow. Open both posts and check that the controls fit on a phone and the pages do not accidentally share a clip. If the iframe appears as text, check that the include call is outside a code fence. If the deployed page still shows the old clip, verify which build is live.

Frequently asked questions

Change title in the post’s include call. The include keeps the shared markup for the site.

You might also like

Host your videos for free and earn from every view

Create your account in under a minute, upload your first video and start earning from day one.