How AI is powering better personalization in e-commerce [with Vercel]. Sign up now

Template values encoding URLs in Sanity starter templates

16 repliesLast updated: Nov 30, 2025

I am currently creating a new starter template and want to use template-values for presetting some stuff.There are also urls in my template values. Unfortunately after replacing the values these are shown as encoded string. Is there any trick to solve this?
e.g.

<https://sanity>...
will become:

https:&amp;#x2F;&amp;#x2F;sanity-...
This happens when running:

sanity-template build --template-values template-values-development.json
AI Update

I understand the issue you're running into! When using sanity-template build --template-values, URLs in your template are being HTML-encoded, turning slashes (/) into &#x2F; entities. This is a known behavior with how the template replacement works.

The Issue

The sanity-template tool uses a templating engine that HTML-encodes values by default for safety. When you have URLs like https://sanity-... in your template values JSON file, the forward slashes get converted to &#x2F; during the build process.

The Solution

Unfortunately, the sanity-template repository has been archived since March 6, 2023, meaning it's no longer actively maintained. However, here are a few workarounds:

Important Note: Given that this tool is archived and no longer maintained by Sanity, you might want to consider alternative approaches for creating starter templates, such as using a more modern templating solution or build tool that gives you better control over encoding behavior.

If you share more details about your specific use case, I can suggest more targeted solutions!

Show original thread
16 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions