Key text field characters stripped on render

We often use key text fields for simple strings in our content. Today we came across an issue where we store HTML for an email template (the Rich Text field doesn't provide enough of the formatting we use so it cannot be used in this instance).

We have some placeholders in that email template for various user fields and custom per-user links e.g

<a href="{signup_link}">Click here</a>

Although this is saved correctly first time, once published and you go back to the page the ="{signup_link}" is stripped out from the editor, and if you then save again that content is lost entirely. We tried various workarounds for this (including <a {signup_link}> and various others) and all got stripped out.

This feels like a bug as it saves correctly first time (and retrieves fine from the API)?



Hello @frstie, thanks for reaching out.

Is this happening inside the documents of your Prismic repository or your application?
Could you show me a visual example? A screenshot or screen recording.


Hi @Pau

Here's a simple example - Title here is a Key Text field. Enter the following:

After clicking save and publish:

Notice that the ="{link}" has disappeared.

At this point the document is saved correctly to the repository as per the API browser:


However if I then make a change to that field the change is lost (unless I enter it all again including the stripped out characters)

Hope that makes sense,


1 Like

I recommend that you switch the Key Text for a Rich Text field. It allows much more formatting options. And for this specific case, you can paste this piece of code inside a preformatted tag. It'll be returned in the following form in the API:

  "type": "preformatted",
  "text": "<a href=\"{signup_link}\">Click here</a>",
  "spans": [ ]

I'm not sure if accepting HTML tags is the intended behaviour of the Key Text Field, but I'll inform the team. Thank you for the additional details!

Hi @Pau

Thanks for getting back to me. We explicitly don't want any formatting for this field - it is essentially the HTML for an email template with some placeholders embedded.

In most cases a Key Text field works as you'd expect for this, other than this odd behaviour in the editing screen in Prismic.

In the end we had to use a Rich Text field for this, not allow any tags apart from paragraphs, and reconstruct the plain text string at the website end from the result, which is not ideal.

If there are good reasons to restrict what can be entered into a Key Text field perhaps another, simpler Plain Text field could be added that didn't have this restriction?


You are right, because this is more likely to be an error in the operation of the Field than its normal behaviour.

I have already informed the team about this case. Now we will follow up on the issue tracker.

The only workaround for this at the minute is to use a Rich Text field with the prefformatted text style for code snippets.

1 Like

This thread is being monitored as an open ticket in the internal Prismic issue tracker. The Prismic support team will update this post as we get more information from our dev team. If you have a similar use-case, you can ‘Flag’ this topic to reopen and add it here.

I second this. We have the exact same issue.

We use a content type 'Corporate Newsletter Sign up' to deploy a Microsoft Dynamics Form Embed Code. We use the ' key text ' field to save the code snippet.
The original code snippet looks like this:

<div data-form-block-id="48b1c758-b631-ec11-b6e6-000d3aae4210"></div> <script src=""></script> <div id="dT6GDjJyiPwjOskzgFzIjsQfU4L5pVs9JwTTT59WbWSA"></div><script src=""></script><div class="d365-mkt-config" style="display:none" data-website-id="T6GDjJyiPwjOskzgFzIjsQfU4L5pVs9JwTTT59WbWSA" data-hostname=""></div>

As soon as we save the localized content the code snippet is displayed incorrectly. Attributes in Div Containers are automatically removed. The Code looks like this:

<div></div> <script src=""></script> <div></div><script src=""></script><div></div>

The original code is saved in the content and deployed accordingly, but the shortened code snippet is displayed incorrectly and also used when we copy the content to another locale, which leads to the code embed not working in that other localized version.

Can you look into this? Maintaining our content is hard enough as it is and quirks like this are hard to keep track of.

Hello everyone, we released a fix for this issue. If you don't see it reflected on your repository yet, please send us a message with the URL of your repository so we can manually.