SEO best practices on Sanity

Omar Benseddik's photo
Omar Benseddik
Posted 2022-09-05 · Updated 2022-09-25 · 7 min

When we build a website with Sanity, we configure SEO best practices to rank higher on search engine result pages.

In this article we'll cover the following 4 items:

  1. On-page SEO
  2. Infrastructure
  3. Content creation experience
  4. Page speed

If you prefer watching instead of reading, here's the video version

On-page SEO

We enable your content editors to control the following:

Title and Meta Description

Titles are used to communicate the topic of the page's content, while meta descriptions are a summary of what the page is about.

Although Google often replaces titles and descriptions, it is still recommended to add them.

We also add a word counter to help your editors not go beyond the recommended limit:

Alt texts

Although Google uses machine learning to detect what an image is about, alt tags are still relevant, and you can add them directly on images:

Write alt tag on Sanity images

Indexation

You can decide if to index or not a page by selecting the appropriate status:

Control indexation from Sanity

Slugs

You have control over the URL slugs. Those can be auto-generated based on a field like Title, and configured to avoid duplicates.

Rendering consistent URLs reliably and without trailing slashes enables consistency.

Structured data

Structured data describes content to search engines, to better understand what's on the pages. You can see what examples apply in your case here.

For Tinloof, we provide Google with structured data about our logo, articles, ratings, and job posts.

Social images

Although social images do not have an impact on SEO, they do on conversion.

On Sanity we can automatically generate an image based on a template following your branding:

Infrastructure

Redirects

If you go through a site migration and change the URL structure, you'd like to avoid returning 404 pages and save your traffic with redirects.

You can easily control that from the Sanity dashboard:

Control redirects from Sanity
Pick status code and destination

Sitemap

Sitemaps are key if you want to help Google crawlers understand the structure of your site. This is especially relevant for new sites or sites that have more than 500 pages.

We automatically generate sitemaps, so you don't have to do anything manual, and submit them to Google Search Console:

Dynamically generate sitemap

Hreflang

If your site has multiple languages, it is imperative to have hreflang tags. That is automatically generated based on the language you're using for the content.

Internal linking

To improve internal linking, we offer content editors the ability to refer to other documents without having to copy paste a URL.

This approach prevents broken links (you can't delete a document that is referenced), and decide if to open in a new tab or not:

Internal linking with Sanity

Referring Documents

Although this doesn't impact directly SEO, it gives great visibility to your content editors about how content is connected across the site, to know when to add internal linking.

For example, in the screenshot below we can see that Tinloof's Homepage is referenced from the Imprint page, the Header and the 404 page:

Referenced documents Sanity

Content editing experience

A smooth content editing experience and minimalist dashboard support your content creators in delivering quality content, which is key.

Hear from Google directly: “Creating compelling and useful content will likely influence your website more than any of the other factors discussed here.”

This becomes even more relevant with Google's Helpful Content update.

Needless to say, the features listed below do not impact directly SEO, but impact the experience of your content creators, which impacts the content quality they produce, which impacts your SEO.

Here are the main features enabling your team producing better content:

Live Preview

Before pushing your content live, you can see how it looks like and see changes real-time.

In fact, as I am writing this, I am using this feature:

Version History

If by mistake someone deletes content, or you want to remind yourself how your page looked like previously, you can easily access that from the Version History panel:

See version history

Collaborative Editing

You can collaborate with your colleagues when creating content, like on Google Docs.

Scheduling (Available on Pro Plan)

This featured is available only on the Pro Plan (as of writing this), and enables your team to schedule the publishing date of content:

Schedule publishing on Sanity

Page speed

Since Sanity acts as a content backend, it doesn't have an impact on how the frontend is configured, which gives us the ability to control the necessary details to achieve peak performance, amongst others:

  • Image optimization
  • Font loading
  • Browser caching
  • Select hosting and deployment provider

In fact, Sanity offers a global content delivery network (CDN) for serving assets, enabling the frontend to load the necessary resources faster.

Tinloof, whose content is backed by Sanity, currently scores 90+ on flagship performance evaluation tools. Try it yourself:

Page Speed Insights

High scores on Page Speed Insights

Measure SEO health

To keep track of SEO health, we use mainly two tools.

First, Ahrefs to clear errors and keep track of pages' growth.

We aim to achieve Health Scores of 100:

Health Score 100 Ahrefs

If you're keen to use Ahrefs, there's a free version called Webmaster Tools.

Second, we use Google Search Console to monitor page experience, core web vitals, and other parameters.

Wins

By following best practices, businesses we support see positive growth in terms of SEO, a couple of examples below:

Zego started to rank first for keywords after we've implemented the right technical SEO set-up:

Zego SEO wins

Exakt Health started ranking immediately on new keywords and jumped to higher positions, right after we've released their new site:

Improving organic traffic for Exakt Health

Frequently Asked Questions

Is the above enough to secure ranking first on Google?

Not always. SEO is complex, and there are many other factors that come into play, such as link building or website structure, which we have not covered in this article.

However, by covering the above, amongst other elements, you increase your likelihood to rank higher, as we've witnessed with our clients.

How is this different from WordPress?

When you use Sanity as your content backend / CMS, you gain flexibility when it to the frontend.

Although WordPress can be used as a separate content backend, it hasn't been designed with that purpose in mind.

Read more about it in this Headless CMS explanation.

Do I need training to use Sanity?

No. It's so easy to use, that our clients pick it up in a matter of minutes.

In fact, we also include an internal guide for onboarding.

Sanity Guide for Onboarding

Is Sanity reliable?

Yes. At Tinloof we’ve been using it for more than two years, without any incident. The following brands also trust it to manage content: Nike, OMA, Cornerstone OnDemandEurostar, and SONOS.

Will content load slowly if it's hosted on Sanity?

No. Sanity's content is CDN-distributed and gives very fast responses. However, you need to have a properly configured frontend.

Recent articles

Images and videos on Sanity

Images and videos have to be properly configured to rank in search engine result pages and not impact negatively page speed. In this piece we discuss how we leverage Sanity to easily...
Omar Benseddik's photo
Omar Benseddik
2022-09-18 · 7 min

Analytics with Sanity

We’ll explain in this article the analytics possibilities with Sanity and how we enable them in our projects.
Seif Ghezala's photo
Seif Ghezala
2022-09-12 · 2 min