How to allow for embed of arbitrary script tag

Hi - I searched but I’m probably searching for the wrong thing, so I hope you’ll bear with me.

I’m considering Kirby (love the idea of it being flat file based and manageable in git), and would like to know if I can have a situation where, in the editor, I can embed script tags from a database we use.

The embed code simply looks like <script>...</script> and can produce a list of data, or, an input form.


Can Kirby be set up to allow this kind of tag to be embedded? What should I read in the manual to see how this works?

Thanks in advance.


Hello and welcome to the forum.

You can add such script tags in textarea fields. Inside the blocks field, however, script tags are automatically wrapped inside code tags.

So it depends on how and where you want to use these tags.

1 Like

Hi @texnixe , really appreciate the quick answer! And I’m glad to hear it’s possible!

A followup, if you don’t mind: after your answer, I searched on here for textarea and script, and found a reference to the opposite idea, of wanting to disallow script tags in a text editor, and @texnixe you mention one can use kirbytext filters to accomplish it.

The link you reference is dead, and I can’t find any reference to kirbytext filters. Do they still exist in the 3.5 version today?

Yes, they are now kirbytext/kirbytags before/after hooks:

It’s no so much about disallowing but rather an option to filter such tags out in a global way. Field methods would be the way to go on the individual field level.

If you want to prevent input of tags in the first place, you can use field validators.

On a side note: If you have a defined set of scripts, it might make sense to store them in snippets and use a custom Kirbytag to reference these scripts rather then actually typing them into the field. They would then be rendered at runtime.