Skip to content

Commit

Permalink
move slug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitchell Christ committed Jun 25, 2024
1 parent cc35983 commit ea6864e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion next/src/types/Sanity.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ declare global {
}

type Metadata = {
slug: { current: string }
title: string
description: string
slug: { current: string }
image?: Image
ogimage?: string
noIndex: boolean
Expand Down
2 changes: 1 addition & 1 deletion next/src/ui/modules/RichtextModule/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function Code({
}) {
if (!value?.code) return null

const html = await codeToHtml(value.code, {
const html = await codeToHtml(stegaClean(value.code), {
lang: value.language,
theme: 'dark-plus',
decorations: value.highlightedLines
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanitypress",
"version": "3.5.2",
"version": "3.6.0",
"description": "A Next.js + Sanity.io Starter Template",
"main": "index.js",
"author": "nuotsu <[email protected]> (https://nuotsu.dev)",
Expand Down
1 change: 0 additions & 1 deletion sanity/schemas/documents/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default defineType({
select: {
title: 'title',
slug: 'metadata.slug.current',
media: 'metadata.image',
},
prepare: ({ title, slug }) => ({
title,
Expand Down
2 changes: 1 addition & 1 deletion sanity/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import testimonialFeatured from './modules/testimonial.featured'
import testimonialList from './modules/testimonial-list'

export const schemaTypes = [
// documents
// documents
site,
page,
blogPost,
Expand Down
16 changes: 8 additions & 8 deletions sanity/schemas/objects/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ export default defineType({
title: 'Metadata',
type: 'object',
fields: [
defineField({
name: 'slug',
type: 'slug',
options: {
source: (doc: any) => doc.metadata.title || doc.name || doc.title,
},
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'title',
type: 'string',
Expand All @@ -16,14 +24,6 @@ export default defineType({
rows: 3,
validation: (Rule) => Rule.max(160).warning(),
}),
defineField({
name: 'slug',
type: 'slug',
options: {
source: (doc: any) => doc.metadata.title || doc.name || doc.title,
},
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'image',
description: 'Used for social sharing previews',
Expand Down

0 comments on commit ea6864e

Please sign in to comment.