A Directus extension for previewing HTML rendering. I designed this primarily to test thumbnail designs in projects for clients. Hopefully this will be useful to other people!
It's currently a very hacky solution, but it works. If there's a better of way doing it, please let me know!
It's based on the Computed Interface plugin by Rezo Labs.
npm i directus-extension-live-preview
- Go to Settings, create a new field with type string or number.
- In the Interface panel, choose Live Preview interface. There are 2 options:
- Template: Similar to M2M interface, determine what HTML is used. Templating similiar to Twig is used for defined fields in the table.
- Display Only: Tick this for it to work.
You can use variables in your HTML. The variables are the fields in the table. For example, if you a field called name, you can use {{name}} in your HTML.
<h1>{{name}}</h1>- Cannot parse literal strings (
{{ 's' }}). - Cannot use relational fields (
{{ user.name }}).