Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ const homeLocation = {
href: '/',
} satisfies DocumentLocation;

// Define the blog page location for the presentation tool
const blogPageLocation = {
title: 'Blog Page',
href: '/blog',
} satisfies DocumentLocation;

// resolveHref() is a convenience function that resolves the URL
// path for different document types and used in the presentation tool.
function resolveHref(documentType?: string, slug?: string): string | undefined {
Expand Down Expand Up @@ -69,10 +75,8 @@ export default defineConfig({
]),
// Locations Resolver API allows you to define where data is being used in your application. https://www.sanity.io/docs/presentation-resolver-api#8d8bca7bfcd7
locations: {
settings: defineLocations({
locations: [homeLocation],
message: 'This document is used on all pages',
tone: 'positive',
blogPage: defineLocations({
locations: [blogPageLocation],
}),
page: defineLocations({
select: {
Expand Down Expand Up @@ -106,6 +110,11 @@ export default defineConfig({
].filter(Boolean) as DocumentLocation[],
}),
}),
settings: defineLocations({
locations: [homeLocation],
message: 'This document is used on all pages',
tone: 'positive',
}),
},
},
}),
Expand Down