Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace SEO with metadata property #40

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { address } from './objects/address';
import { basicBlockContent } from './objects/basic-block-content';
import { blockContent } from './objects/block-content';
import { link } from './objects/link';
import { metadata, searchEngine, socialMedia } from './objects/meta-data';
import { privacyOptions } from './objects/privacy-options';
import { seo } from './objects/seo';
import { organization } from './organization';
Expand All @@ -20,4 +21,7 @@ export const schemaTypes = [
basicBlockContent,
blockContent,
privacyOptions,
metadata,
searchEngine,
socialMedia,
];
66 changes: 66 additions & 0 deletions schemas/objects/meta-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { defineType } from 'sanity';

export const metadata = defineType({
name: 'metadata',
title: 'Metadata',
type: 'object',
fields: [
{
name: 'searchEngine',
type: 'searchEngine',
validation: Rule => Rule.required(),
},
{
name: 'socialMedia',
type: 'socialMedia',
validation: Rule => Rule.required(),
},
],
});

export const searchEngine = defineType({
name: 'searchEngine',
title: 'Search engine',
type: 'object',
fields: [
{
name: 'Title',
type: 'string',
description:
'search engine title. The ideal length is 50–60 characters. When exceeding this limit, search engines will truncate the title.',
},
{
name: 'Description',
type: 'string',
description:
'search engine description. minimum length is 70 characters, and ideal is between 70 to 155 characters. When exceeding this limit, search engines will truncate the description.',
},
],
});

export const socialMedia = defineType({
name: 'socialMedia',
title: 'Social media',
type: 'object',
fields: [
{
name: 'Title',
type: 'string',
description:
'social media title. The ideal length is 47 characters. When exceeding this limit, social media will truncate the title. Linkedin will truncate the title at 119 characters.',
},
{
name: 'Description',
type: 'string',
description:
'social media description. Shuold not exceed 85 characters to fit most platforms.',
},
{
name: 'Images',
type: 'array',
of: [{ type: 'image' }],
description:
'social media image. The ideal size is 1200 x 630 pixels. When proviing multiple images, the first will be used as the main image. Some platforms will allow user to choose which image to use.',
},
],
});
6 changes: 6 additions & 0 deletions schemas/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ export const project = defineType({
group: 'metadata',
type: 'seo',
},
{
name: 'metadata',
title: 'Metadata',
group: 'metadata',
type: 'metadata',
},
],
preview: {
select: {
Expand Down