
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI 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 / 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 / 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:
Use triple braces (if supported): Some templating engines use triple braces {{{variable}}} instead of double braces to avoid HTML encoding. Check if your template syntax supports this.
Post-process the build output: After running the build command, you could run a script to decode the HTML entities:
# After building
find ./build -type f -exec sed -i 's///\//g' {} +Manual replacement in template files: Instead of putting full URLs in your template-values JSON, consider:
Fork and modify: Since the tool is archived, you could fork the repository and modify the template replacement logic to handle URLs without encoding them.
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!
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store