
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, creating a singleton for the blog archive page is a great approach! Here's how you'd set this up:
A singleton document is perfect for your blog archive page because it's a unique page that only needs one instance. Unlike your regular pages with pageBuilder arrays, the blog archive singleton would contain metadata and settings specific to the archive page, while your actual posts are queried dynamically.
Your blog archive singleton might look like this:
export const blogArchive = defineType({
name: 'blogArchive',
title: 'Blog Archive',
type: 'document',
fields: [
defineField({
name: 'title',
type: 'string',
title: 'Page Title'
}),
defineField({
name: 'description',
type: 'text',
title: 'Page Description'
}),
defineField({
name: 'seo',
type: 'seo', // your SEO object
}),
defineField({
name: 'postsPerPage',
type: 'number',
title: 'Posts Per Page',
initialValue: 10
}),
// Optional: featured posts
defineField({
name: 'featuredPosts',
type: 'array',
of: [{ type: 'reference', to: [{ type: 'post' }] }]
})
]
})The singleton stores settings, not the posts themselves. You'd query posts separately using GROQ:
// Get the archive settings
const archiveSettings = await client.fetch(`*[_type == "blogArchive"][0]`)
// Get all posts (sorted by date)
const posts = await client.fetch(`
*[_type == "post"] | order(publishedAt desc) {
_id,
title,
slug,
excerpt,
publishedAt,
author->
}
`)You'll need to configure your sanity.config.js to make it a proper singleton by customizing the Structure Builder, filtering templates, and limiting document actions. The singleton document guide has the full implementation details, or you can use the singleton-tools plugin for easier setup.
This approach keeps your content architecture clean: regular pages use pageBuilder for flexibility, while the blog archive uses a singleton for configuration + dynamic GROQ queries for the actual post list.
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