Visual Editing with Next.js App Router and Sanity Studio
Setup "Live by Default" fetches and interactive live preview with Presentation in Sanity Studio
Go to Visual Editing with Next.js App Router and Sanity StudioThinking about your audience as one group is a handy way get things done. But people’s needs change based on who they are, where they are, and what they’re really after.
This guide will show you how to tailor your content to meet the needs of different people. With personalized and localized content you can deliver better experiences across a wider range of cultures, languages, and tastes.
Personalization is when you send different content to your audience based on what you know about them. Depending on what you do, the knowledge you use can be from a variety of sources including:
Only use data your audience has consented to share, or information that you can reasonably assume about them without harming their right to privacy.
How you personalize content for them is just as flexible. Here are a few ideas:
Be mindful of assuming too much about somebody without having the data you need to support your assumptions. Sending the wrong personalized message to the wrong recipient may do more harm than good. If in doubt, apply the precautionary principle, and use something fit for all.
Localization is simply a form of personalization that focuses on content targeted towards your audience‘s location. You may have encountered localized content on a website, where applying a region or language preference lets you use the site in a way that makes the most sense for where you are.
While language translations are really common, localization can be much more than that. Great localization experiences can tailor news feeds, images, currencies, shipping settings, and much more in order to make the customer experience as relevant as it can be.
CandiCorp’s subscription pilot is only being trialed in the EU‘s Nordic states. To avoid disappointing customers from other regions, they restrict the promotion of the program to website visitors and catalog recipients from these countries only.
Sanity lets you tailor content in a way that makes the most sense to you. You provide tailored content exactly the same way you do other fields or types in your content model. It’s possible to choose between field and document level localization, or a mix of the two. Be as simple or complex as you like.
This flexible, needs-based approach should outlast a preconfigured solution in the long-run and is a pathway to better content experiences because you can blend personalization and localization needs any way you like.
Tailored content can be as simple as adding new fields to your document, or an embedded object. Here‘s a Title field in English, Swedish, and Norwegian:
// schemas/documents/article.js
export default {
title: 'Article',
name: 'article',
type: 'document',
fields: [
{
title: 'Title',
name: 'localizedTitle',
type: 'object',
fields: [
{ title: 'English', name: 'en', type: 'string' },
{ title: 'Norwegian', name: 'no', type: 'string' },
{ title: 'Swedish', name: 'sw', type: 'string' },
]
},
// etc...
]
}
You can also apply customization at the document level. This basic example lets you set the language type when creating a new document:
// schemas/documents/article.js
export default {
title: 'Article',
name: 'article',
type: 'document',
fields: [
{
title: "Language",
type: "string",
name: "language",
options: {
list: [
{title: 'English', value: 'en'},
{title: 'Norwegian', value: 'no'},
{title: 'Swedish', value: 'se'},
]
}
},
// etc...
]
}
These examples are simple, but the principles are extendable to any use case.
We learned that it’s possible to create tailored content for audiences of all persuasions. We broke down the difference between personalization and localization and looked at ways to provide for both using Sanity. Next up, we’ll customize Sanity Studio for faster flows and better content.
Sanity Composable Content Cloud is the headless CMS that gives you (and your team) a content backend to drive websites and applications with modern tooling. It offers a real-time editing environment for content creators that’s easy to configure but designed to be customized with JavaScript and React when needed. With the hosted document store, you query content freely and easily integrate with any framework or data source to distribute and enrich content.
Sanity scales from weekend projects to enterprise needs and is used by companies like Puma, AT&T, Burger King, Tata, and Figma.
Setup "Live by Default" fetches and interactive live preview with Presentation in Sanity Studio
Go to Visual Editing with Next.js App Router and Sanity StudioA complete guide to setting up your blog using Astro and Sanity
Go to Build your blog with Astro and SanityThis guide teaches how to add a custom input component to a field for Sanity Studio v3
Go to How to build an input component for Sanity Studio v3A thorough intro to using GROQ-projections in a webhook contest
Go to GROQ-Powered Webhooks – Intro to Projections