I’m using the Starertkit and would like to extend the image files blueprint to also work for videos. I’m surprised that video support is lacking in Kirby 3, but is there a way to at least to treat videos the same as images and show the same fields below? At the moment it just says:
This page has no blueprint setup yet
Thanks!
Jamie
You can set the file template
property in your files section.
File blueprints are defined in /site/blueprints/files
, anything you have defined there, you can use as a template in your files sections. The Starterkit only has a single file blueprint called image.yml
with the following content:
title: Image
columns:
- width: 1/2
sections:
content:
type: fields
fields:
caption:
label: Caption
type: textarea
size: medium
- width: 1/2
sections:
meta:
type: fields
fields:
alt:
label: Alternative Text
type: text
photographer:
label: Photogapher
type: text
width: 2/3
license:
label: License
type: select
width: 1/3
options:
- Unsplash
- CC BY 4.0
- CC BY-SA 4.0
- CC BY-NC 4.0
- CC BY-ND 4.0
link:
label: Link
type: url
And assigned in the images section of the album.yml
blueprint like this:
sections:
images:
type: files
layout: cards
template: image #assign the image.yml file blueprint
info: "{{ file.dimensions }}"
image:
ratio: 5/4
cover: true
min: 1
size: small
It would probably make more sense to define a separate files blueprint for videos, so that you can limit the files section to videos and users can’t upload images or PDFs to that section.
Well, what you probably mean is that there is no video preview in the Panel? You can create acustom section with video previews if you need this.
Thanks @texnixe . I have a mix of videos (.mp4) and images in my files section. When I add template: image
it removes the .mp4s from the files list. What’s causing this and is there a way to resolve it?
That is because your videos don’t have a template entry in their meta data file yet if you add the template after you have already uploaded the videos.
You can do one of two things:
- remove the videos and upload them again (this will automatically add the assigned template in the meta data file)
- add the template in the meta data file manually or programmatically
A filled in meta data file that uses the image template looks like this:
Caption:
----
Alt: A colorful fish
----
Photographer: Pietro Jeng
----
License: Unsplash
----
Link: https://unsplash.com/photos/0Sd2qqU5soQ
----
Template: image
----
Sort: 4
Example from the photography/animals
folder.
1 Like
Doh, of course! Thanks again!