Kirby tag, multiple inputs/values


#1

I’m making a custom kirby tag so the client can add a slideshow into the text content wherever they want. I was thinking of the following structure:

(slideshow: image1.jpg, image2.jpg, image3.jpg)

Is it possible to pass multiple, unnamed values to a custom tag, or do I need to label each value like the following, which does not look clean:

(slideshow: image1.jpg, 2:image2.jpg, 3:image3.jpg)


#2

It won’t work with commas as it is used to separate the tag attributes.

Since you are creating the Kirby tag, I would suggest you to use |. That way you can use the explode function to make an array out of it:

(slideshow: image1.jpg|image2.jpg|image3.jpg)

#3

Äh, sorry to correct you, @pedroborges. Using commas to separate items is perfectly valid and they are not used to separate tag attributes. There is no comma between tag attributes.

So this:

(slideshow: image1.jpg, image2.jpg, image3.jpg)

is fine and in fact used in other tags.

A standard tag with multiple attributes looks like this:

(image: mywonderfulimage.jpg caption: Greatest image ever class: superclass)

#4

Thanks for correcting me @texnixe. In the back of my mind I thought it was that way without checking. Now I learned something :slight_smile: