← All articles
Development2025-10-02 · 6 min

Your website with a blog in one click, with Sanity and Next.js

What if I told you that you can build your website with a blog in one click, literally, and without WordPress? That's what I do in this video, starting from a ready-made template by Sanity, a headless CMS: you create pages and posts from its panel, a bit like WordPress but nicer for developers.

All that's left for you is to change the styling however you like.

Sanity's templates

▶ Watch from 00:00

Sanity's website has a Templates section full of free resources to start a project: websites, e-commerce and much more, for several frameworks. I use Next.js, but there are also Astro, SvelteKit and others.

Some templates are official, others are made by the community. I've looked at the code of quite a few and they're really well made: I think the Sanity team reviews them carefully before publishing.

The Clean Next.js + Sanity app template

▶ Watch from 01:34

The one I'm using today is Clean Next.js + Sanity app, an official template. The Use template button creates, in one click, a website with a blog already connected, all editable from Sanity.

Clean Next.js + Sanity app template page among Sanity's templates, with Use template and Preview buttons
The official Clean Next.js + Sanity app template.

The starting site has a home page with the latest posts, an About page (you can create more pages and add them to the menu) and the posts section. Each post has its own page and, at the bottom, related posts.

Home page of the template's demo site, with the Sanity + Next.js heading
The template's demo site: you start here and change the styling.

You get all of this working and can customise the styling as you like, starting from clean code written by the Sanity team.

Creating the project in one click

▶ Watch from 03:08

Click Use template, name the project (I called mine SuperBlog) and pick the organisation. Sanity creates the project in your dashboard and shows a guide made for this template: I'd follow it step by step.

The first step is a command to run in the terminal, already filled in with your project ID:

npm create sanity@latest -- --template sanity-io/sanity-template-nextjs-clean --project <PROJECT-ID> --dataset production

The command does quite a lot on its own. It adds localhost:3333, where Sanity Studio runs, and localhost:3000, where the site runs, to the CORS origins, so you avoid CORS errors. It also generates the API token for live preview, which lets you edit content straight from the site, a bit like WordPress.

Site and Studio in the same project

▶ Watch from 04:38

The code is cleanly split: the frontend folder holds the site, which pulls data from Sanity, and the studio folder holds Sanity Studio. The root package.json has scripts to start them separately or together:

package.json (excerpt)
"scripts": {
  "dev": "npm-run-all --parallel --print-label dev:*",
  "dev:next": "npm run dev --workspace=frontend",
  "dev:studio": "npm run dev --workspace=studio"
}

npm run dev starts both in parallel. On localhost:3000 there's the site, still empty: the About page doesn't exist and there are no posts, but each one already has a button to create it. On localhost:3333 there's the Studio, with sections for pages, posts, authors (People) and site settings.

Creating the first post

▶ Watch from 06:16

In the Studio, under Posts, create a new post: title, slug, content, an excerpt (the short description shown in previews), cover image, date and author. Authors are the People: the template is already set up for a blog written by several people.

There's also an Unsplash integration, so you can pick images from there or upload them from your own library, with their alt text. Publish, refresh the site and the post is already in Recent Posts, with its full page.

Recent Posts section of the site with the first post just published from Sanity Studio
The first post, published from the Studio, shows up on the site right away.

Everything is already in place: the structure will need extending for your project, but you start from a very clean setup.

Building pages with the page builder

▶ Watch from 08:18

Pages are created in the Studio too, with a heading, a subheading and a block-based page builder. The template has two sample blocks, a text section and a call to action. A real site needs more, depending on the design: you create new blocks yourself in Sanity's schemas.

Sanity Studio with a new page and the page builder showing Title section and Call to action blocks
The page builder: every page is made of blocks.

The call-to-action button can point to a page or post on the site, or to an external link, even in a new tab. It's handy for internal linking between pages. Publish, and the new page is live at its address, with the button leading to the post.

Visual editing, like WordPress

▶ Watch from 10:52

My favourite part is the Presentation tab. You see the site inside the Studio, hover over an element and, when you click it, the field to edit opens on the right, right at the line you clicked.

Sanity Presentation tab: the post on the site on the left, the panel with the same text to edit on the right
Presentation: click the text on the site and edit it in the panel on the right.

This was what Sanity, and most headless CMSs, lacked compared to a classic CMS like WordPress. For a client it makes a big difference: editing everything through fields and forms can be confusing at first, while live editing is a huge help.

Templates yes, but basics first

▶ Watch from 12:28

I think these templates are brilliant: they get you started with disarming ease and speed, whether it's a website, a landing page, a blog or an e-commerce store. Still, it's always worth starting from the basics, because with a ready-made template you risk skipping how Sanity works and how to change its various parts.

And if you need a website or product built on Sanity and Next.js without having to learn it from scratch, that's the kind of project I take from the start all the way to launch.