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

add seo config with fallback seo #642

Merged
merged 2 commits into from
Sep 13, 2024
Merged
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
2 changes: 2 additions & 0 deletions studio/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import companyLocation from "./schemas/documents/companyLocation";
import compensations from "./schemas/documents/compensations";
import redirect from "./schemas/documents/redirect";
import benefitsByLocation from "./schemas/objects/compensations/benefitsByLocation";
import seoFallback from "./schemas/documents/admin/fallbackSeo";

export const schema: { types: SchemaTypeDefinition[] } = {
types: [
Expand All @@ -34,5 +35,6 @@ export const schema: { types: SchemaTypeDefinition[] } = {
redirect,
benefitsByLocation,
companyLocation,
seoFallback,
],
};
19 changes: 19 additions & 0 deletions studio/schemas/deskStructure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import {
CaseIcon,
DoubleChevronRightIcon,
PinIcon,
SearchIcon,
} from "@sanity/icons";
import { soMeLinksID } from "./documents/socialMediaProfiles";
import { companyInfoID } from "./documents/companyInfo";
import { legalDocumentID } from "./documents/legalDocuments";
import { compensationsId } from "./documents/compensations";
import { redirectId } from "./documents/redirect";
import { companyLocationID } from "./documents/companyLocation";
import { seoFallbackID } from "./documents/admin/fallbackSeo";

// Admin Section
const adminSection = (S: StructureBuilder) =>
Expand Down Expand Up @@ -77,6 +79,23 @@ const siteSettingSection = (S: StructureBuilder) =>
.child(
S.document().schemaType(soMeLinksID).documentId(soMeLinksID),
),
S.listItem()
.title("SEO Configurations")
.icon(SearchIcon)
.child(
S.list()
.title("SEO Configurations")
.items([
S.listItem()
.title("Fallback SEO")
.child(
S.document()
.schemaType(seoFallbackID)
.documentId(seoFallbackID)
.title("Fallback SEO"),
),
]),
),
S.listItem()
.title("Broken Links")
.icon(DoubleChevronRightIcon)
Expand Down
32 changes: 32 additions & 0 deletions studio/schemas/documents/admin/fallbackSeo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { defineField, defineType } from "sanity";
import seo from "studio/schemas/objects/seo";

export const seoFallbackID = "seoFallback";

const seoFallback = defineType({
name: seoFallbackID,
type: "document",
title: "SEO Configurations",
description:
"Configure global settings for your site including brand assets, tracking codes, and default SEO settings.",
fields: [
defineField({
...seo,
title: "Default SEO Settings",
description:
"If page-specific SEO settings are not provided, these settings will be applied as default.",
options: {
collapsible: false,
},
}),
],
preview: {
prepare() {
return {
title: "SEO Configurations",
};
},
},
});

export default seoFallback;
2 changes: 1 addition & 1 deletion studio/schemas/objects/seo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineField, StringInputProps } from "sanity";
import { defineField } from "sanity";
import { StringInputWithCharacterCount } from "studio/components/stringInputWithCharacterCount/StringInputWithCharacterCount";

const seoFieldID = {
Expand Down