Multiple templates for files?

Hi everyone,

Currently looking into moving from WP to Kirby for my online portfolio and ran into a question which I could not find an answer to:

In the " Asset management" video on Kirby YouTube channel, it is mentioned that you can not create multiple blueprints for files ( i.e. one for images and one for video )

• Is this still the case for Kirby 3.6?
• If so what is the approach when you have a portfolio project containing both video and images?

My portfolio projects often contains a mix of video and images so different blueprints for each would be needed.

Any input or feedback is greatly appreciated.

Hello and welcome to our forum.

That is probably a misunderstanding. A single file can only have one template assigned.

Different files can have different templates assigned, provided they are uploaded through different files sections or fields.

For example 2 sections:

sections:
  # section for images with image template
  videos:
    type: files
    template: image
  # section for videos with video template
  images:
    type: files
    template: video

Both templates should then restrict the type of files you can upload through each section.

Alternatively, you could use a file.create:after hook to assign a template to a file based on file type (in a section that doesn’t assign a template at all), file.create:after | Kirby CMS

Thank you so much Texnixe, that makes perfectly sense!