bsmnt 0.4.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/application/add-hooks/index.d.ts.map +1 -1
- package/dist/application/add-hooks/index.js +1 -0
- package/dist/application/add-hooks/index.js.map +1 -1
- package/dist/application/add-integration/index.d.ts +33 -8
- package/dist/application/add-integration/index.d.ts.map +1 -1
- package/dist/application/add-integration/index.js +221 -90
- package/dist/application/add-integration/index.js.map +1 -1
- package/dist/application/create-project/build-context.d.ts +3 -1
- package/dist/application/create-project/build-context.d.ts.map +1 -1
- package/dist/application/create-project/build-context.js +2 -1
- package/dist/application/create-project/build-context.js.map +1 -1
- package/dist/application/create-project/index.d.ts +3 -1
- package/dist/application/create-project/index.d.ts.map +1 -1
- package/dist/application/create-project/index.js +4 -2
- package/dist/application/create-project/index.js.map +1 -1
- package/dist/application/create-project/map-selection-to-registry.js +1 -1
- package/dist/application/create-project/map-selection-to-registry.js.map +1 -1
- package/dist/application/install-skills/index.js +1 -1
- package/dist/application/install-skills/index.js.map +1 -1
- package/dist/application/shared/project-detection.d.ts +2 -2
- package/dist/application/shared/project-detection.d.ts.map +1 -1
- package/dist/application/shared/project-detection.js +2 -2
- package/dist/application/shared/project-detection.js.map +1 -1
- package/dist/core/create/execute-plan.d.ts +4 -0
- package/dist/core/create/execute-plan.d.ts.map +1 -1
- package/dist/core/create/execute-plan.js +8 -0
- package/dist/core/create/execute-plan.js.map +1 -1
- package/dist/core/create/internal-ids.d.ts +4 -1
- package/dist/core/create/internal-ids.d.ts.map +1 -1
- package/dist/core/create/internal-ids.js +6 -1
- package/dist/core/create/internal-ids.js.map +1 -1
- package/dist/core/create/types.d.ts +2 -0
- package/dist/core/create/types.d.ts.map +1 -1
- package/dist/domain/cms.d.ts +0 -7
- package/dist/domain/cms.d.ts.map +1 -1
- package/dist/domain/cms.js.map +1 -1
- package/dist/domain/forms.d.ts +17 -0
- package/dist/domain/forms.d.ts.map +1 -0
- package/dist/domain/forms.js +13 -0
- package/dist/domain/forms.js.map +1 -0
- package/dist/domain/integration.d.ts +30 -0
- package/dist/domain/integration.d.ts.map +1 -0
- package/dist/domain/integration.js +12 -0
- package/dist/domain/integration.js.map +1 -0
- package/dist/domain/skills.d.ts +58 -0
- package/dist/domain/skills.d.ts.map +1 -1
- package/dist/domain/skills.js +52 -0
- package/dist/domain/skills.js.map +1 -1
- package/dist/index.js +114 -38
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/agents/register-sanity-mcp.js +9 -6
- package/dist/infrastructure/agents/register-sanity-mcp.js.map +1 -1
- package/dist/infrastructure/create/apply-package-json.d.ts.map +1 -1
- package/dist/infrastructure/create/apply-package-json.js +19 -0
- package/dist/infrastructure/create/apply-package-json.js.map +1 -1
- package/dist/infrastructure/create/executor.d.ts.map +1 -1
- package/dist/infrastructure/create/executor.js +5 -0
- package/dist/infrastructure/create/executor.js.map +1 -1
- package/dist/infrastructure/create/install-dependencies.d.ts.map +1 -1
- package/dist/infrastructure/create/install-dependencies.js +4 -0
- package/dist/infrastructure/create/install-dependencies.js.map +1 -1
- package/dist/infrastructure/create/lifecycle-registry.d.ts.map +1 -1
- package/dist/infrastructure/create/lifecycle-registry.js +2 -0
- package/dist/infrastructure/create/lifecycle-registry.js.map +1 -1
- package/dist/infrastructure/create/merge-registry.d.ts.map +1 -1
- package/dist/infrastructure/create/merge-registry.js +8 -0
- package/dist/infrastructure/create/merge-registry.js.map +1 -1
- package/dist/infrastructure/create/setup-agent.d.ts +2 -0
- package/dist/infrastructure/create/setup-agent.d.ts.map +1 -1
- package/dist/infrastructure/create/setup-agent.js +32 -8
- package/dist/infrastructure/create/setup-agent.js.map +1 -1
- package/dist/infrastructure/create/setup-dotenvx.d.ts +41 -0
- package/dist/infrastructure/create/setup-dotenvx.d.ts.map +1 -0
- package/dist/infrastructure/create/setup-dotenvx.js +502 -0
- package/dist/infrastructure/create/setup-dotenvx.js.map +1 -0
- package/dist/infrastructure/create/setup-sanity.d.ts +13 -1
- package/dist/infrastructure/create/setup-sanity.d.ts.map +1 -1
- package/dist/infrastructure/create/setup-sanity.js +74 -31
- package/dist/infrastructure/create/setup-sanity.js.map +1 -1
- package/dist/infrastructure/integrations/inject-integration.d.ts +3 -3
- package/dist/infrastructure/integrations/inject-integration.d.ts.map +1 -1
- package/dist/infrastructure/integrations/inject-integration.js +81 -37
- package/dist/infrastructure/integrations/inject-integration.js.map +1 -1
- package/dist/modules/features/cms/sanity/config.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/config.js +13 -6
- package/dist/modules/features/cms/sanity/config.js.map +1 -1
- package/dist/modules/features/cms/sanity/index.js +8 -2
- package/dist/modules/features/cms/sanity/index.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.d.ts +13 -0
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.d.ts.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.js +38 -0
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.js.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/knip.d.ts +12 -0
- package/dist/modules/features/cms/sanity/mergers/knip.d.ts.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/knip.js +38 -0
- package/dist/modules/features/cms/sanity/mergers/knip.js.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/layout.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/layout.js +17 -3
- package/dist/modules/features/cms/sanity/mergers/layout.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/sitemap.d.ts +3 -3
- package/dist/modules/features/cms/sanity/mergers/sitemap.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/sitemap.js +48 -62
- package/dist/modules/features/cms/sanity/mergers/sitemap.js.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/config.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/config.js +8 -5
- package/dist/modules/features/cms/sanity-pagebuilder/config.js.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/index.js +2 -2
- package/dist/modules/features/cms/sanity-pagebuilder/index.js.map +1 -1
- package/dist/modules/features/env/dotenvx/config.d.ts +13 -0
- package/dist/modules/features/env/dotenvx/config.d.ts.map +1 -0
- package/dist/modules/features/env/dotenvx/config.js +47 -0
- package/dist/modules/features/env/dotenvx/config.js.map +1 -0
- package/dist/modules/features/forms/hubspot/config.d.ts +31 -0
- package/dist/modules/features/forms/hubspot/config.d.ts.map +1 -0
- package/dist/modules/features/forms/hubspot/config.js +25 -0
- package/dist/modules/features/forms/hubspot/config.js.map +1 -0
- package/dist/paths.d.ts +16 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +16 -0
- package/dist/paths.js.map +1 -1
- package/package.json +21 -9
- package/src/agent-skills/json-ld/SKILL.md +85 -0
- package/src/agent-skills/manage-env/SKILL.md +67 -0
- package/src/assets/check-node-version.mjs +22 -0
- package/src/modules/features/cms/sanity/files/app/blog/[slug]/page.tsx +48 -21
- package/src/modules/features/cms/sanity/files/app/blog/page.tsx +54 -0
- package/src/modules/features/cms/sanity/files/app/feed.xml/route.ts +36 -0
- package/src/modules/features/cms/sanity/files/components/sanity/structured-data.tsx +83 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/components/disable-draft-mode.tsx +3 -3
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/queries.ts +14 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/sanity.config.ts +19 -3
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/sanity.types.ts +1 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/article.ts +7 -7
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/index.ts +36 -1
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/metadata.ts +12 -1
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/structured-data-blocks.ts +416 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/structured-data.ts +100 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/structure.ts +37 -2
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/utils/page-json-ld.ts +208 -0
- package/src/modules/features/cms/sanity/files/lib/scripts/setup-ci-secrets.ts +117 -0
- package/src/modules/features/cms/sanity/files/lib/utils/rss.ts +96 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/.knip.json +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/[[...slug]]/route.ts +100 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/draft-mode/disable/route.ts +7 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/draft-mode/enable/route.ts +20 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/revalidate/route.ts +126 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/feed.xml/route.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/sitemap.md/route.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/studio/[[...tool]]/page.tsx +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/draft-mode-toggle.tsx +27 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/rich-text.tsx +87 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/visual-editing.tsx +28 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/ui/sanity-image/index.tsx +41 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/check-integration.ts +5 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/client.ts +27 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/disable-draft-mode.tsx +23 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/page-builder-input.tsx +39 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/page-category-input.tsx +50 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/same-as-input.tsx +66 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/slug-field.tsx +18 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/slug-input.tsx +14 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/confirm-publish-action.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/env.ts +34 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/fetchers/layout.ts +67 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/fetchers/redirects.ts +17 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/icons.ts +79 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/live/index.tsx +88 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/markdown-proxy.config.ts +50 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-builder-config.ts +130 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-category.ts +28 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-tree-pane.tsx +420 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/pinned-pages.ts +54 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/presentation.ts +119 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/queries.ts +407 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/sanity.cli.ts +29 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/sanity.config.ts +113 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/index.ts +4 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/blog-content.ts +89 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/description.ts +29 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/hero.ts +28 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/singleton/content-collection.ts +45 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/content/author.ts +70 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/content/blog-category.ts +55 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/index.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/company-data.ts +70 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/footer.ts +79 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/navbar.ts +75 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/redirect.ts +120 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/structured-data.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/link.ts +125 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/logo-field.ts +9 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/metadata.ts +79 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/nav-objects.ts +192 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page-builder.ts +39 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page-folder.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page.ts +242 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/richText.ts +63 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/structured-data-blocks.ts +436 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/singletons.ts +51 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/structure.ts +330 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/image.ts +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/link.ts +140 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/page-builder-markdown.ts +81 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/page-json-ld.ts +208 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/scripts/sanity-typegen.ts +45 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/check-redirect.ts +30 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/json-ld.tsx +521 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/metadata.ts +167 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/rss.ts +96 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/sitemap.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/proxy.ts +81 -0
- package/src/modules/features/env/dotenvx/files/decrypt-env.mjs +45 -0
- package/src/modules/features/env/dotenvx/files/gitleaks.yml +25 -0
- package/src/modules/features/env/dotenvx/files/instrumentation.ts +14 -0
- package/src/modules/features/env/dotenvx/files/push-keys.mjs +129 -0
- package/src/modules/features/env/dotenvx/files/save-key.mjs +108 -0
- package/src/modules/features/env/dotenvx/files/setup-env.mjs +67 -0
- package/src/modules/features/env/dotenvx/files/vercelignore +4 -0
- package/src/modules/features/env/dotenvx/files/write-env.mjs +47 -0
- package/src/templates/next-default/.env.example +14 -6
- package/src/templates/next-default/.github/workflows/ci.yml +83 -0
- package/src/templates/next-default/.vscode/extensions.json +3 -0
- package/src/templates/next-default/README.md +53 -0
- package/src/templates/next-default/knip.json +14 -0
- package/src/templates/next-default/lefthook.yml +5 -0
- package/src/templates/next-default/lib/utils/json-ld.tsx +327 -21
- package/src/templates/next-default/next.config.ts +6 -0
- package/src/templates/next-default/package.json +8 -4
- package/src/templates/next-experiments/.env.example +14 -6
- package/src/templates/next-experiments/.github/workflows/ci.yml +83 -0
- package/src/templates/next-experiments/.vscode/extensions.json +3 -0
- package/src/templates/next-experiments/README.md +53 -0
- package/src/templates/next-experiments/knip.json +14 -0
- package/src/templates/next-experiments/lefthook.yml +30 -0
- package/src/templates/next-experiments/lib/utils/json-ld.tsx +327 -21
- package/src/templates/next-experiments/next.config.ts +6 -0
- package/src/templates/next-experiments/package.json +10 -2
- package/src/templates/next-pagebuilder/.env.example +19 -1
- package/src/templates/next-pagebuilder/.github/workflows/ci.yml +90 -0
- package/src/templates/next-pagebuilder/.vscode/extensions.json +3 -0
- package/src/templates/next-pagebuilder/README.md +65 -0
- package/src/templates/next-pagebuilder/app/(content)/[[...slug]]/page.tsx +6 -1
- package/src/templates/next-pagebuilder/app/(content)/layout.tsx +3 -12
- package/src/templates/next-pagebuilder/components/layout/footer/index.tsx +11 -10
- package/src/templates/next-pagebuilder/components/layout/header/index.tsx +5 -3
- package/src/templates/next-pagebuilder/components/layout/json-ld/index.tsx +38 -26
- package/src/templates/next-pagebuilder/components/layout/wrapper/index.tsx +3 -11
- package/src/templates/next-pagebuilder/components/page-builder/components/content-collection/index.tsx +1 -1
- package/src/templates/next-pagebuilder/components/page-document/index.tsx +38 -0
- package/src/templates/next-pagebuilder/knip.json +27 -0
- package/src/templates/next-pagebuilder/lefthook.yml +5 -0
- package/src/templates/next-pagebuilder/lib/integrations/sanity/sanity.types.ts +36 -2
- package/src/templates/next-pagebuilder/lib/scripts/setup-ci-secrets.ts +117 -0
- package/src/templates/next-pagebuilder/next.config.ts +6 -0
- package/src/templates/next-pagebuilder/package.json +9 -3
- package/src/templates/next-webgl/.env.example +14 -6
- package/src/templates/next-webgl/.github/workflows/ci.yml +83 -0
- package/src/templates/next-webgl/.vscode/extensions.json +3 -0
- package/src/templates/next-webgl/README.md +53 -0
- package/src/templates/next-webgl/knip.json +13 -0
- package/src/templates/next-webgl/lefthook.yml +5 -0
- package/src/templates/next-webgl/lib/utils/json-ld.tsx +327 -21
- package/src/templates/next-webgl/next.config.ts +6 -0
- package/src/templates/next-webgl/package.json +8 -4
- package/src/modules/features/cms/sanity/files/lib/utils/json-ld.tsx +0 -244
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import Link from "next/link";
|
|
4
4
|
import { usePathname } from "next/navigation";
|
|
5
|
-
import {
|
|
5
|
+
import { useIsPresentationTool } from "next-sanity/hooks";
|
|
6
6
|
|
|
7
7
|
export function DisableDraftMode() {
|
|
8
|
-
const
|
|
8
|
+
const isPresentationTool = useIsPresentationTool();
|
|
9
9
|
const pathname = usePathname();
|
|
10
10
|
|
|
11
11
|
// Only show the disable draft mode button when outside of Presentation Tool
|
|
12
|
-
if (
|
|
12
|
+
if (isPresentationTool) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -64,3 +64,17 @@ export const ARTICLE_BY_ID_QUERY = defineQuery(`
|
|
|
64
64
|
_updatedAt
|
|
65
65
|
}
|
|
66
66
|
`);
|
|
67
|
+
|
|
68
|
+
// Site-wide structured data (JSON-LD Organization + WebSite identity)
|
|
69
|
+
export const STRUCTURED_DATA_QUERY = defineQuery(`
|
|
70
|
+
*[_type == "structuredData"][0]{
|
|
71
|
+
name,
|
|
72
|
+
legalName,
|
|
73
|
+
description,
|
|
74
|
+
url,
|
|
75
|
+
"logo": logo.asset->url,
|
|
76
|
+
sameAs,
|
|
77
|
+
contactPoint,
|
|
78
|
+
address
|
|
79
|
+
}
|
|
80
|
+
`);
|
|
@@ -16,6 +16,10 @@ import { apiVersion, dataset, previewURL, projectId } from "./env";
|
|
|
16
16
|
import { schema } from "./schemas";
|
|
17
17
|
import { structure } from "./structure";
|
|
18
18
|
|
|
19
|
+
// Document types pinned to a single editable document.
|
|
20
|
+
const SINGLETON_TYPES = new Set(["structuredData"]);
|
|
21
|
+
const SINGLETON_ACTIONS = new Set(["publish", "discardChanges", "restore"]);
|
|
22
|
+
|
|
19
23
|
// Helper function for URL resolution
|
|
20
24
|
function resolveHref(documentType?: string, slug?: string): string | undefined {
|
|
21
25
|
switch (documentType) {
|
|
@@ -77,15 +81,27 @@ export default defineConfig({
|
|
|
77
81
|
media(),
|
|
78
82
|
],
|
|
79
83
|
document: {
|
|
80
|
-
actions: (prev) => {
|
|
84
|
+
actions: (prev, context) => {
|
|
81
85
|
const isProd = process.env.NODE_ENV === "production";
|
|
82
|
-
if (!isProd) return prev;
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
// Singletons can't be created or deleted from the document pane.
|
|
88
|
+
const filtered = SINGLETON_TYPES.has(context.schemaType)
|
|
89
|
+
? prev.filter(
|
|
90
|
+
(action) =>
|
|
91
|
+
action.action !== undefined &&
|
|
92
|
+
SINGLETON_ACTIONS.has(action.action),
|
|
93
|
+
)
|
|
94
|
+
: prev;
|
|
95
|
+
|
|
96
|
+
if (!isProd) return filtered;
|
|
97
|
+
|
|
98
|
+
return filtered.map((action) =>
|
|
85
99
|
action.action === "publish"
|
|
86
100
|
? createConfirmPublishAction(action)
|
|
87
101
|
: action,
|
|
88
102
|
);
|
|
89
103
|
},
|
|
104
|
+
newDocumentOptions: (prev) =>
|
|
105
|
+
prev.filter((option) => !SINGLETON_TYPES.has(option.templateId)),
|
|
90
106
|
},
|
|
91
107
|
});
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { defineField, defineType } from "sanity";
|
|
2
2
|
|
|
3
3
|
const articleFields = [
|
|
4
|
-
defineField({
|
|
5
|
-
name: "title",
|
|
6
|
-
title: "Title",
|
|
7
|
-
type: "string",
|
|
8
|
-
description: "The title of the article",
|
|
9
|
-
validation: (Rule) => Rule.required(),
|
|
10
|
-
}),
|
|
11
4
|
defineField({
|
|
12
5
|
name: "excerpt",
|
|
13
6
|
title: "Excerpt",
|
|
@@ -66,6 +59,13 @@ export const article = defineType({
|
|
|
66
59
|
title: "Article",
|
|
67
60
|
type: "document",
|
|
68
61
|
fields: [
|
|
62
|
+
defineField({
|
|
63
|
+
name: "title",
|
|
64
|
+
title: "Title",
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "The title of the article",
|
|
67
|
+
validation: (Rule) => Rule.required(),
|
|
68
|
+
}),
|
|
69
69
|
defineField({
|
|
70
70
|
name: "slug",
|
|
71
71
|
title: "Slug",
|
|
@@ -13,9 +13,34 @@ import { link } from "./link";
|
|
|
13
13
|
import { metadata } from "./metadata";
|
|
14
14
|
import { navigation } from "./navigation";
|
|
15
15
|
import { richText } from "./richText";
|
|
16
|
+
import { structuredData } from "./structured-data";
|
|
17
|
+
import {
|
|
18
|
+
customJsonLd,
|
|
19
|
+
eventJsonLd,
|
|
20
|
+
faqJsonLd,
|
|
21
|
+
itemListJsonLd,
|
|
22
|
+
jobPostingJsonLd,
|
|
23
|
+
softwareApplicationJsonLd,
|
|
24
|
+
videoJsonLd,
|
|
25
|
+
} from "./structured-data-blocks";
|
|
16
26
|
|
|
17
27
|
// Re-export all schemas for convenience
|
|
18
|
-
export {
|
|
28
|
+
export {
|
|
29
|
+
article,
|
|
30
|
+
customJsonLd,
|
|
31
|
+
eventJsonLd,
|
|
32
|
+
example,
|
|
33
|
+
faqJsonLd,
|
|
34
|
+
itemListJsonLd,
|
|
35
|
+
jobPostingJsonLd,
|
|
36
|
+
link,
|
|
37
|
+
metadata,
|
|
38
|
+
navigation,
|
|
39
|
+
richText,
|
|
40
|
+
softwareApplicationJsonLd,
|
|
41
|
+
structuredData,
|
|
42
|
+
videoJsonLd,
|
|
43
|
+
};
|
|
19
44
|
|
|
20
45
|
// Schema collection for Sanity configuration
|
|
21
46
|
export const schema: { types: SchemaTypeDefinition[] } = {
|
|
@@ -25,11 +50,21 @@ export const schema: { types: SchemaTypeDefinition[] } = {
|
|
|
25
50
|
metadata,
|
|
26
51
|
richText,
|
|
27
52
|
|
|
53
|
+
// Page-level JSON-LD blocks (selectable in metadata)
|
|
54
|
+
faqJsonLd,
|
|
55
|
+
eventJsonLd,
|
|
56
|
+
videoJsonLd,
|
|
57
|
+
jobPostingJsonLd,
|
|
58
|
+
softwareApplicationJsonLd,
|
|
59
|
+
itemListJsonLd,
|
|
60
|
+
customJsonLd,
|
|
61
|
+
|
|
28
62
|
// Document types (content pages)
|
|
29
63
|
article,
|
|
30
64
|
example,
|
|
31
65
|
|
|
32
66
|
// Singleton types (one-off content)
|
|
33
67
|
navigation,
|
|
68
|
+
structuredData,
|
|
34
69
|
],
|
|
35
70
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineField, defineType } from "sanity";
|
|
1
|
+
import { defineArrayMember, defineField, defineType } from "sanity";
|
|
2
|
+
import { pageJsonLdMembers } from "./structured-data-blocks";
|
|
2
3
|
|
|
3
4
|
export const metadata = defineType({
|
|
4
5
|
name: "metadata",
|
|
@@ -64,5 +65,15 @@ export const metadata = defineType({
|
|
|
64
65
|
description: "Prevent search engines from indexing this page",
|
|
65
66
|
initialValue: false,
|
|
66
67
|
}),
|
|
68
|
+
defineField({
|
|
69
|
+
name: "jsonLd",
|
|
70
|
+
title: "Structured Data (JSON-LD)",
|
|
71
|
+
type: "array",
|
|
72
|
+
description:
|
|
73
|
+
"Page-level schema.org structured data emitted as JSON-LD. Pick a predefined type, or add a Custom JSON-LD block for anything not listed.",
|
|
74
|
+
of: pageJsonLdMembers.map((member) =>
|
|
75
|
+
defineArrayMember({ type: member.name }),
|
|
76
|
+
),
|
|
77
|
+
}),
|
|
67
78
|
],
|
|
68
79
|
});
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import { defineArrayMember, defineField, defineType } from "sanity";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Editor-selectable JSON-LD blocks (predefined schema.org types + a raw
|
|
5
|
+
* `customJsonLd` escape hatch), each emitted as its own script tag.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const faqJsonLd = defineType({
|
|
9
|
+
name: "faqJsonLd",
|
|
10
|
+
title: "FAQ",
|
|
11
|
+
type: "object",
|
|
12
|
+
fields: [
|
|
13
|
+
defineField({
|
|
14
|
+
name: "questions",
|
|
15
|
+
title: "Questions",
|
|
16
|
+
type: "array",
|
|
17
|
+
validation: (Rule) => Rule.min(1),
|
|
18
|
+
of: [
|
|
19
|
+
defineArrayMember({
|
|
20
|
+
type: "object",
|
|
21
|
+
fields: [
|
|
22
|
+
defineField({
|
|
23
|
+
name: "question",
|
|
24
|
+
title: "Question",
|
|
25
|
+
type: "string",
|
|
26
|
+
validation: (Rule) => Rule.required(),
|
|
27
|
+
}),
|
|
28
|
+
defineField({
|
|
29
|
+
name: "answer",
|
|
30
|
+
title: "Answer",
|
|
31
|
+
type: "text",
|
|
32
|
+
rows: 3,
|
|
33
|
+
validation: (Rule) => Rule.required(),
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
preview: {
|
|
37
|
+
select: { title: "question", subtitle: "answer" },
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
preview: {
|
|
44
|
+
select: { questions: "questions" },
|
|
45
|
+
prepare: ({ questions }) => ({
|
|
46
|
+
title: "FAQ",
|
|
47
|
+
subtitle: `${Array.isArray(questions) ? questions.length : 0} question(s)`,
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const jobPostingJsonLd = defineType({
|
|
53
|
+
name: "jobPostingJsonLd",
|
|
54
|
+
title: "Job Posting",
|
|
55
|
+
type: "object",
|
|
56
|
+
fields: [
|
|
57
|
+
defineField({
|
|
58
|
+
name: "title",
|
|
59
|
+
title: "Job Title",
|
|
60
|
+
type: "string",
|
|
61
|
+
validation: (Rule) => Rule.required(),
|
|
62
|
+
}),
|
|
63
|
+
defineField({
|
|
64
|
+
name: "description",
|
|
65
|
+
title: "Description",
|
|
66
|
+
type: "text",
|
|
67
|
+
rows: 4,
|
|
68
|
+
validation: (Rule) => Rule.required(),
|
|
69
|
+
}),
|
|
70
|
+
defineField({
|
|
71
|
+
name: "datePosted",
|
|
72
|
+
title: "Date Posted",
|
|
73
|
+
type: "datetime",
|
|
74
|
+
validation: (Rule) => Rule.required(),
|
|
75
|
+
}),
|
|
76
|
+
defineField({
|
|
77
|
+
name: "validThrough",
|
|
78
|
+
title: "Valid Through",
|
|
79
|
+
type: "datetime",
|
|
80
|
+
description: "When the posting expires.",
|
|
81
|
+
}),
|
|
82
|
+
defineField({
|
|
83
|
+
name: "employmentType",
|
|
84
|
+
title: "Employment Type",
|
|
85
|
+
type: "string",
|
|
86
|
+
options: {
|
|
87
|
+
list: [
|
|
88
|
+
{ title: "Full-time", value: "FULL_TIME" },
|
|
89
|
+
{ title: "Part-time", value: "PART_TIME" },
|
|
90
|
+
{ title: "Contractor", value: "CONTRACTOR" },
|
|
91
|
+
{ title: "Temporary", value: "TEMPORARY" },
|
|
92
|
+
{ title: "Intern", value: "INTERN" },
|
|
93
|
+
{ title: "Volunteer", value: "VOLUNTEER" },
|
|
94
|
+
{ title: "Per diem", value: "PER_DIEM" },
|
|
95
|
+
{ title: "Other", value: "OTHER" },
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
}),
|
|
99
|
+
defineField({
|
|
100
|
+
name: "organizationName",
|
|
101
|
+
title: "Hiring Organization",
|
|
102
|
+
type: "string",
|
|
103
|
+
}),
|
|
104
|
+
defineField({
|
|
105
|
+
name: "organizationUrl",
|
|
106
|
+
title: "Organization URL",
|
|
107
|
+
type: "url",
|
|
108
|
+
}),
|
|
109
|
+
defineField({
|
|
110
|
+
name: "remote",
|
|
111
|
+
title: "Remote / Telecommute",
|
|
112
|
+
type: "boolean",
|
|
113
|
+
initialValue: false,
|
|
114
|
+
}),
|
|
115
|
+
defineField({ name: "locality", title: "City", type: "string" }),
|
|
116
|
+
defineField({ name: "region", title: "Region / State", type: "string" }),
|
|
117
|
+
defineField({ name: "country", title: "Country", type: "string" }),
|
|
118
|
+
],
|
|
119
|
+
preview: {
|
|
120
|
+
select: { title: "title", subtitle: "organizationName" },
|
|
121
|
+
prepare: ({ title, subtitle }) => ({
|
|
122
|
+
title: title || "Job Posting",
|
|
123
|
+
subtitle: subtitle ? `Job · ${subtitle}` : "Job Posting",
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export const softwareApplicationJsonLd = defineType({
|
|
129
|
+
name: "softwareApplicationJsonLd",
|
|
130
|
+
title: "Software Application",
|
|
131
|
+
type: "object",
|
|
132
|
+
fields: [
|
|
133
|
+
defineField({
|
|
134
|
+
name: "name",
|
|
135
|
+
title: "Name",
|
|
136
|
+
type: "string",
|
|
137
|
+
validation: (Rule) => Rule.required(),
|
|
138
|
+
}),
|
|
139
|
+
defineField({
|
|
140
|
+
name: "description",
|
|
141
|
+
title: "Description",
|
|
142
|
+
type: "text",
|
|
143
|
+
rows: 2,
|
|
144
|
+
}),
|
|
145
|
+
defineField({
|
|
146
|
+
name: "applicationCategory",
|
|
147
|
+
title: "Application Category",
|
|
148
|
+
type: "string",
|
|
149
|
+
options: {
|
|
150
|
+
list: [
|
|
151
|
+
{ title: "Web application", value: "WebApplication" },
|
|
152
|
+
{ title: "Mobile application", value: "MobileApplication" },
|
|
153
|
+
{ title: "Developer tool", value: "DeveloperApplication" },
|
|
154
|
+
{ title: "Business application", value: "BusinessApplication" },
|
|
155
|
+
{ title: "Design application", value: "DesignApplication" },
|
|
156
|
+
{ title: "Game", value: "GameApplication" },
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
}),
|
|
160
|
+
defineField({
|
|
161
|
+
name: "operatingSystem",
|
|
162
|
+
title: "Operating System",
|
|
163
|
+
type: "string",
|
|
164
|
+
description: "e.g. 'Web', 'macOS, Windows', 'iOS, Android'.",
|
|
165
|
+
}),
|
|
166
|
+
defineField({
|
|
167
|
+
name: "price",
|
|
168
|
+
title: "Price",
|
|
169
|
+
type: "number",
|
|
170
|
+
description: "Use 0 for free apps. Enables the rich result.",
|
|
171
|
+
}),
|
|
172
|
+
defineField({
|
|
173
|
+
name: "currency",
|
|
174
|
+
title: "Currency",
|
|
175
|
+
type: "string",
|
|
176
|
+
description: "ISO 4217 code, e.g. USD, EUR.",
|
|
177
|
+
initialValue: "USD",
|
|
178
|
+
}),
|
|
179
|
+
defineField({ name: "url", title: "URL", type: "url" }),
|
|
180
|
+
defineField({ name: "image", title: "Screenshot / Icon", type: "image" }),
|
|
181
|
+
],
|
|
182
|
+
preview: {
|
|
183
|
+
select: { title: "name", subtitle: "applicationCategory" },
|
|
184
|
+
prepare: ({ title, subtitle }) => ({
|
|
185
|
+
title: title || "Software Application",
|
|
186
|
+
subtitle: subtitle ? `App · ${subtitle}` : "Software Application",
|
|
187
|
+
}),
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
export const itemListJsonLd = defineType({
|
|
192
|
+
name: "itemListJsonLd",
|
|
193
|
+
title: "Item List / Carousel",
|
|
194
|
+
type: "object",
|
|
195
|
+
description:
|
|
196
|
+
"An ordered list of links (e.g. a carousel of articles or products). Each item points to a page on your site.",
|
|
197
|
+
fields: [
|
|
198
|
+
defineField({
|
|
199
|
+
name: "name",
|
|
200
|
+
title: "List Name",
|
|
201
|
+
type: "string",
|
|
202
|
+
description: "Optional title for the list.",
|
|
203
|
+
}),
|
|
204
|
+
defineField({
|
|
205
|
+
name: "items",
|
|
206
|
+
title: "Items",
|
|
207
|
+
type: "array",
|
|
208
|
+
validation: (Rule) => Rule.min(1),
|
|
209
|
+
of: [
|
|
210
|
+
defineArrayMember({
|
|
211
|
+
type: "object",
|
|
212
|
+
fields: [
|
|
213
|
+
defineField({
|
|
214
|
+
name: "name",
|
|
215
|
+
title: "Name",
|
|
216
|
+
type: "string",
|
|
217
|
+
validation: (Rule) => Rule.required(),
|
|
218
|
+
}),
|
|
219
|
+
defineField({
|
|
220
|
+
name: "url",
|
|
221
|
+
title: "URL",
|
|
222
|
+
type: "url",
|
|
223
|
+
validation: (Rule) => Rule.required(),
|
|
224
|
+
}),
|
|
225
|
+
],
|
|
226
|
+
preview: {
|
|
227
|
+
select: { title: "name", subtitle: "url" },
|
|
228
|
+
},
|
|
229
|
+
}),
|
|
230
|
+
],
|
|
231
|
+
}),
|
|
232
|
+
],
|
|
233
|
+
preview: {
|
|
234
|
+
select: { title: "name", items: "items" },
|
|
235
|
+
prepare: ({ title, items }) => ({
|
|
236
|
+
title: title || "Item List / Carousel",
|
|
237
|
+
subtitle: `${Array.isArray(items) ? items.length : 0} item(s)`,
|
|
238
|
+
}),
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
export const eventJsonLd = defineType({
|
|
243
|
+
name: "eventJsonLd",
|
|
244
|
+
title: "Event",
|
|
245
|
+
type: "object",
|
|
246
|
+
fields: [
|
|
247
|
+
defineField({
|
|
248
|
+
name: "name",
|
|
249
|
+
title: "Name",
|
|
250
|
+
type: "string",
|
|
251
|
+
validation: (Rule) => Rule.required(),
|
|
252
|
+
}),
|
|
253
|
+
defineField({
|
|
254
|
+
name: "description",
|
|
255
|
+
title: "Description",
|
|
256
|
+
type: "text",
|
|
257
|
+
rows: 2,
|
|
258
|
+
}),
|
|
259
|
+
defineField({
|
|
260
|
+
name: "startDate",
|
|
261
|
+
title: "Start Date",
|
|
262
|
+
type: "datetime",
|
|
263
|
+
validation: (Rule) => Rule.required(),
|
|
264
|
+
}),
|
|
265
|
+
defineField({ name: "endDate", title: "End Date", type: "datetime" }),
|
|
266
|
+
defineField({
|
|
267
|
+
name: "locationName",
|
|
268
|
+
title: "Location Name",
|
|
269
|
+
type: "string",
|
|
270
|
+
description: "Venue name, or leave blank for online events.",
|
|
271
|
+
}),
|
|
272
|
+
defineField({
|
|
273
|
+
name: "locationAddress",
|
|
274
|
+
title: "Location Address",
|
|
275
|
+
type: "string",
|
|
276
|
+
}),
|
|
277
|
+
defineField({ name: "url", title: "Event URL", type: "url" }),
|
|
278
|
+
defineField({ name: "image", title: "Image", type: "image" }),
|
|
279
|
+
],
|
|
280
|
+
preview: {
|
|
281
|
+
select: { title: "name", subtitle: "startDate" },
|
|
282
|
+
prepare: ({ title, subtitle }) => ({
|
|
283
|
+
title: title || "Event",
|
|
284
|
+
subtitle: subtitle ? `Event · ${subtitle}` : "Event",
|
|
285
|
+
}),
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
export const videoJsonLd = defineType({
|
|
290
|
+
name: "videoJsonLd",
|
|
291
|
+
title: "Video",
|
|
292
|
+
type: "object",
|
|
293
|
+
fields: [
|
|
294
|
+
defineField({
|
|
295
|
+
name: "name",
|
|
296
|
+
title: "Name",
|
|
297
|
+
type: "string",
|
|
298
|
+
validation: (Rule) => Rule.required(),
|
|
299
|
+
}),
|
|
300
|
+
defineField({
|
|
301
|
+
name: "description",
|
|
302
|
+
title: "Description",
|
|
303
|
+
type: "text",
|
|
304
|
+
rows: 2,
|
|
305
|
+
validation: (Rule) => Rule.required(),
|
|
306
|
+
}),
|
|
307
|
+
defineField({
|
|
308
|
+
name: "thumbnail",
|
|
309
|
+
title: "Thumbnail",
|
|
310
|
+
type: "image",
|
|
311
|
+
validation: (Rule) => Rule.required(),
|
|
312
|
+
}),
|
|
313
|
+
defineField({
|
|
314
|
+
name: "uploadDate",
|
|
315
|
+
title: "Upload Date",
|
|
316
|
+
type: "datetime",
|
|
317
|
+
validation: (Rule) => Rule.required(),
|
|
318
|
+
}),
|
|
319
|
+
defineField({
|
|
320
|
+
name: "contentUrl",
|
|
321
|
+
title: "Content URL",
|
|
322
|
+
type: "url",
|
|
323
|
+
description: "Direct link to the video file (.mp4, etc.).",
|
|
324
|
+
}),
|
|
325
|
+
defineField({
|
|
326
|
+
name: "embedUrl",
|
|
327
|
+
title: "Embed URL",
|
|
328
|
+
type: "url",
|
|
329
|
+
description: "Player embed URL (YouTube, Vimeo, etc.).",
|
|
330
|
+
}),
|
|
331
|
+
],
|
|
332
|
+
preview: {
|
|
333
|
+
select: { title: "name" },
|
|
334
|
+
prepare: ({ title }) => ({
|
|
335
|
+
title: title || "Video",
|
|
336
|
+
subtitle: "Video",
|
|
337
|
+
}),
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
export const customJsonLd = defineType({
|
|
342
|
+
name: "customJsonLd",
|
|
343
|
+
title: "Custom JSON-LD",
|
|
344
|
+
type: "object",
|
|
345
|
+
description:
|
|
346
|
+
"Optional JSON-LD block for advanced rich results (FAQ, Product, HowTo, etc.). Emits its own <script> tag. Validate snippets with https://search.google.com/test/rich-results — invalid blocks are skipped at render time.",
|
|
347
|
+
fields: [
|
|
348
|
+
defineField({
|
|
349
|
+
name: "label",
|
|
350
|
+
title: "Internal Label",
|
|
351
|
+
type: "string",
|
|
352
|
+
description:
|
|
353
|
+
"For your reference only (e.g. 'FAQ – pricing tiers'). Not emitted.",
|
|
354
|
+
validation: (Rule) => Rule.required(),
|
|
355
|
+
}),
|
|
356
|
+
defineField({
|
|
357
|
+
name: "json",
|
|
358
|
+
title: "JSON-LD",
|
|
359
|
+
type: "text",
|
|
360
|
+
rows: 10,
|
|
361
|
+
description:
|
|
362
|
+
"Paste a single schema.org JSON-LD object. Omit the <script> wrapper. Must include an @type (@context is added automatically if omitted).",
|
|
363
|
+
validation: (Rule) =>
|
|
364
|
+
Rule.required().custom((value) => {
|
|
365
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
366
|
+
return "JSON-LD is required";
|
|
367
|
+
}
|
|
368
|
+
try {
|
|
369
|
+
const parsed = JSON.parse(value);
|
|
370
|
+
if (Array.isArray(parsed)) {
|
|
371
|
+
return "Use one block per entry (split arrays into multiple blocks).";
|
|
372
|
+
}
|
|
373
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
374
|
+
return "Must be a JSON object.";
|
|
375
|
+
}
|
|
376
|
+
if (!("@type" in parsed)) {
|
|
377
|
+
return 'Must include an @type (e.g. "@type": "FAQPage").';
|
|
378
|
+
}
|
|
379
|
+
return true;
|
|
380
|
+
} catch {
|
|
381
|
+
return "Invalid JSON. Use https://jsonlint.com to debug.";
|
|
382
|
+
}
|
|
383
|
+
}),
|
|
384
|
+
}),
|
|
385
|
+
],
|
|
386
|
+
preview: {
|
|
387
|
+
select: { title: "label", subtitle: "json" },
|
|
388
|
+
prepare: ({ title, subtitle }) => {
|
|
389
|
+
let type: string | undefined;
|
|
390
|
+
if (typeof subtitle === "string") {
|
|
391
|
+
try {
|
|
392
|
+
const parsed = JSON.parse(subtitle);
|
|
393
|
+
if (parsed && typeof parsed === "object" && "@type" in parsed) {
|
|
394
|
+
type = String(parsed["@type"]);
|
|
395
|
+
}
|
|
396
|
+
} catch {
|
|
397
|
+
// ignore — render-time skips invalid blocks
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
title: title || "Custom JSON-LD",
|
|
402
|
+
subtitle: type ? `@type: ${type}` : "JSON-LD",
|
|
403
|
+
};
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
export const pageJsonLdMembers = [
|
|
409
|
+
faqJsonLd,
|
|
410
|
+
eventJsonLd,
|
|
411
|
+
videoJsonLd,
|
|
412
|
+
jobPostingJsonLd,
|
|
413
|
+
softwareApplicationJsonLd,
|
|
414
|
+
itemListJsonLd,
|
|
415
|
+
customJsonLd,
|
|
416
|
+
] as const;
|