Add Custom Embed or HTML code

To add a custom embed code or raw HTML, you will first need to set up a unique field or Slice specifically for this. Then you will need to add code to your website application to handle this new field.

1. Create a new field for the HTML

You have two options, using a Key Text field or a Rich Text field.

with a Rich text field

We recommend you using a customized Rich Text field specifically for your custom code. You will need to configure the field to "Allow multiple paragraphs" and set the field only to allow preformatted text.

with a Key Text field

If you use the Key Text field, you can paste the code you need into it. Then it will output as plain text, which you can inject straight into your code. This option will appear as one big string in the Prismic interface.

When using this option, your code might also be encoded when you save the document. Using this method, you will likely need to unencode the content before adding it to your pages.

2. Add the new field to your website application

The next step is to update your website code to handle this new field. You will need to output this field as plain text straight into your template.

If you aren't a developer, then you will likely need help from your dev team for this step.

Then in your project code, you will output the text as HTML.

You can then build your page with Slices as so:

[ Text Slice ]
[ HTML Slice ]
[ Text Slice ]