-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
129 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
defineLocations, | ||
type PresentationPluginOptions, | ||
} from 'sanity/presentation' | ||
|
||
export const resolve: PresentationPluginOptions['resolve'] = { | ||
locations: { | ||
page: defineLocations({ | ||
select: { | ||
metadata: 'metadata', | ||
}, | ||
resolve: (doc) => { | ||
const slug = doc?.metadata?.slug?.current | ||
|
||
return { | ||
locations: [ | ||
{ | ||
title: doc?.metadata?.title, | ||
href: slug === 'index' ? '/' : `/${slug}`, | ||
}, | ||
], | ||
} | ||
}, | ||
}), | ||
|
||
'blog.post': defineLocations({ | ||
select: { | ||
metadata: 'metadata', | ||
}, | ||
resolve: (doc) => ({ | ||
locations: [ | ||
{ | ||
title: doc?.metadata?.title, | ||
href: `/blog/${doc?.metadata?.slug?.current}`, | ||
}, | ||
], | ||
}), | ||
}), | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { draftMode } from 'next/headers' | ||
import { NextRequest, NextResponse } from 'next/server' | ||
|
||
export async function GET(request: NextRequest) { | ||
;(await draftMode()).disable() | ||
|
||
const url = new URL(request.nextUrl) | ||
|
||
return NextResponse.redirect(new URL('/', url.origin)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineEnableDraftMode } from 'next-sanity/draft-mode' | ||
import client from '@/lib/sanity/client' | ||
import { token } from '@/lib/sanity/token' | ||
|
||
export const { GET } = defineEnableDraftMode({ | ||
client: client.withConfig({ token }), | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export default process.env.NODE_ENV === 'development' | ||
export const dev = process.env.NODE_ENV === 'development' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import { createClient } from 'next-sanity' | ||
import dev from '@/lib/env' | ||
import { projectId, dataset, apiVersion } from '@/lib/sanity/env' | ||
import { dev } from '@/lib/env' | ||
|
||
export default createClient({ | ||
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID, | ||
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET, | ||
// token: process.env.NEXT_PUBLIC_SANITY_TOKEN for private datasets | ||
apiVersion: '2024-10-30', | ||
projectId, | ||
dataset, | ||
apiVersion, | ||
useCdn: !dev, | ||
stega: { | ||
enabled: false, | ||
studioUrl: '/admin', | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID | ||
export const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET | ||
|
||
export const apiVersion = | ||
process.env.NEXT_PUBLIC_SANITY_API_VERSION || '2024-11-01' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.