Newb needs help embedding single video in a folder

Years ago I managed to create some templates like photo.php and default.php which allow me to drop photos in folders and have them displayed with little extra work.

Today I cannot work out how to approach a simple folder-page that shows a single video. I’ll probably use vimeo-based videos if it makes it easier.

Could someone tell me what I need to learn to do this please? I find it baffling now – a folder, a text document, a plugin?

I found some short bits of code like this

(vimeo: http://vimeo.com/3432886 caption: This is a really nice video)

but I have no idea where to put them.

Thank-you

Hi @mr_datsun!

This is called Kirby Tag and can be used on any text field that is echoed on the template using the kirbytext() method.

You can find more info about the built-in Vimeo Kirby Tag at: https://getkirby.com/docs/cheatsheet/kirbytags/vimeo

I would recommend the above method in situations where you want to add a video here and there. If you’ll always have a Vimeo video to that page type, add a dedicated field to the blueprint and use it on the template. Here’s an example to help you get started:

# site/blueprints/video.yml

title: Page

fields:
  title:
    label: Title
    type:  text

  vimeo:
    label: Vimeo Video ID
    type:  url

And for the template:

<!-- site/templates/video.php -->
<?php snippet('header') ?>

  <main class="main" role="main">

    <header class="wrap">
      <h1><?= $page->title()->html() ?></h1>
    </header>
      
    <div class="text wrap">
      <iframe src="https://player.vimeo.com/video/<?= $page->vimeo() ?>" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
    </div>

  </main>

<?php snippet('footer') ?>

Hi pedro

So helpful. Thank-you. Yes – it was printing stuff into the template with kirbytext(). It began to come back to me as I looked at my old templates to see how it worked. I got the video up with title and description in a jiffy. Video.php:

<?php snippet('header') ?>
<?php snippet('menu') ?>
<?php snippet('submenu') ?>

<section class="content">

  <article>
	<h1><?php echo html($page->title()) ?></h1>
   	 <?php echo kirbytext($page->text()) ?>
        <?php echo kirbytext("(vimeo: http://vimeo.com/122808703 caption: XXXXXX)") ?>
  </article>

</section>

<?php snippet('footer') ?>

I have also just upgraded to Kirby 2 in the last day or two, so later I will read up about blueprints and as I add more videos try them as you suggested. Again many thanks!

Not sure how to mark this as solved…