create-nextblock 0.15.9 → 0.16.1

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.
Files changed (52) hide show
  1. package/package.json +1 -1
  2. package/templates/nextblock-template/app/api/ai/seo/alt-text/route.ts +221 -0
  3. package/templates/nextblock-template/app/api/ai/seo/metadata/route.ts +186 -0
  4. package/templates/nextblock-template/app/api/cron/reset-sandbox/sandboxResetSql.ts +193 -1
  5. package/templates/nextblock-template/app/cms/CmsClientLayout.tsx +7 -1
  6. package/templates/nextblock-template/app/cms/blocks/components/BlockEditorArea.tsx +27 -0
  7. package/templates/nextblock-template/app/cms/blocks/editors/ImageBlockEditor.tsx +406 -229
  8. package/templates/nextblock-template/app/cms/blocks/editors/TextBlockEditor.tsx +171 -6
  9. package/templates/nextblock-template/app/cms/components/FeatureImageField.tsx +254 -245
  10. package/templates/nextblock-template/app/cms/media/components/MediaEditForm.tsx +177 -2
  11. package/templates/nextblock-template/app/cms/pages/[id]/edit/EditPageClient.tsx +28 -0
  12. package/templates/nextblock-template/app/cms/pages/components/PageForm.tsx +649 -406
  13. package/templates/nextblock-template/app/cms/posts/[id]/edit/page.tsx +33 -0
  14. package/templates/nextblock-template/app/cms/posts/components/PostForm.tsx +618 -383
  15. package/templates/nextblock-template/app/cms/settings/seo/RedirectsCard.tsx +514 -0
  16. package/templates/nextblock-template/app/cms/settings/seo/RobotsCard.tsx +529 -0
  17. package/templates/nextblock-template/app/cms/settings/seo/SeoSettingsClient.tsx +57 -0
  18. package/templates/nextblock-template/app/cms/settings/seo/actions.ts +448 -0
  19. package/templates/nextblock-template/app/cms/settings/seo/mappers.ts +93 -0
  20. package/templates/nextblock-template/app/cms/settings/seo/page.tsx +46 -0
  21. package/templates/nextblock-template/app/cms/settings/seo/require-admin.ts +47 -0
  22. package/templates/nextblock-template/app/layout.tsx +1 -1
  23. package/templates/nextblock-template/app/robots.ts +123 -0
  24. package/templates/nextblock-template/app/sitemap.ts +1 -1
  25. package/templates/nextblock-template/components/seo/GenerateMetaButton.tsx +137 -0
  26. package/templates/nextblock-template/components/seo/PageSeoAuditSection.tsx +244 -0
  27. package/templates/nextblock-template/components/seo/SeoAuditPanel.tsx +749 -0
  28. package/templates/nextblock-template/components/seo/SeoIssueList.tsx +195 -0
  29. package/templates/nextblock-template/components/seo/SeoScoreDial.tsx +144 -0
  30. package/templates/nextblock-template/components/seo/SocialPreview.tsx +243 -0
  31. package/templates/nextblock-template/components/seo/SocialPreviewDialog.tsx +110 -0
  32. package/templates/nextblock-template/lib/cortex-ai/alt-text-request.ts +86 -0
  33. package/templates/nextblock-template/lib/cortex-ai/sandbox-headers.ts +60 -0
  34. package/templates/nextblock-template/lib/seo/alt-text-write-back.test.ts +154 -0
  35. package/templates/nextblock-template/lib/seo/alt-text-write-back.ts +109 -0
  36. package/templates/nextblock-template/lib/seo/block-content.ts +123 -0
  37. package/templates/nextblock-template/lib/seo/fix-prompts.test.ts +242 -0
  38. package/templates/nextblock-template/lib/seo/fix-prompts.ts +204 -0
  39. package/templates/nextblock-template/lib/seo/page-audit-context.tsx +140 -0
  40. package/templates/nextblock-template/lib/seo/page-document.test.ts +350 -0
  41. package/templates/nextblock-template/lib/seo/page-document.ts +412 -0
  42. package/templates/nextblock-template/lib/seo/redirect-store.test.ts +479 -0
  43. package/templates/nextblock-template/lib/seo/redirect-store.ts +466 -0
  44. package/templates/nextblock-template/lib/seo/robots-settings-signature.test.ts +102 -0
  45. package/templates/nextblock-template/lib/seo/robots-settings-signature.ts +41 -0
  46. package/templates/nextblock-template/lib/seo/robots-txt.test.ts +370 -0
  47. package/templates/nextblock-template/lib/seo/robots-txt.ts +510 -0
  48. package/templates/nextblock-template/lib/setup/migrations-bundle.ts +10 -0
  49. package/templates/nextblock-template/next-env.d.ts +2 -2
  50. package/templates/nextblock-template/package.json +1 -1
  51. package/templates/nextblock-template/proxy.ts +240 -20
  52. package/templates/nextblock-template/app/robots.txt/route.ts +0 -32
@@ -21,6 +21,8 @@ import { CortexAiPageContextRegistrar } from "../../../components/CortexAiPageCo
21
21
  import DraftStatusActions from "../../../components/DraftStatusActions";
22
22
  import VisibilityControl from "../../../components/VisibilityControl";
23
23
  import { buildViewUrl } from "../../../../../lib/publishing/viewUrl";
24
+ import { PageSeoAuditSection } from "../../../../../components/seo/PageSeoAuditSection";
25
+ import { PageSeoProvider } from "../../../../../lib/seo/page-audit-context";
24
26
 
25
27
  type PostType = Database['public']['Tables']['posts']['Row'];
26
28
  type BlockType = Database['public']['Tables']['blocks']['Row'];
@@ -172,6 +174,25 @@ export default async function EditPostPage(props: { params: Promise<{ id: string
172
174
  translationGroupId: postWithBlocks.translation_group_id,
173
175
  }}
174
176
  />
177
+ {/*
178
+ A server component may render a client provider around client children,
179
+ which is the whole reason this file does not need converting: everything
180
+ inside the provider that touches the context — the form, the block editor
181
+ and the audit section — is already a client component, and this file
182
+ stays an RSC that can keep awaiting Supabase above them.
183
+
184
+ The provider must enclose both `PostForm` and `BlockEditorArea` because
185
+ the audit is assembled from halves they each own: the form publishes the
186
+ meta title and description, the block editor publishes the live blocks.
187
+ Seeding it from the row (draft overlay included, since `postWithBlocks`
188
+ already carries it) means the panel grades the real article on first
189
+ paint instead of an empty document.
190
+ */}
191
+ <PageSeoProvider
192
+ initialBlocks={postWithBlocks.blocks}
193
+ initialMetaDescription={postWithBlocks.meta_description}
194
+ initialMetaTitle={postWithBlocks.meta_title}
195
+ >
175
196
  <div className="space-y-8 w-full mx-auto px-6">
176
197
  <div className="flex justify-between items-center flex-wrap gap-4 w-full">
177
198
  <div className="flex items-center gap-3">
@@ -235,6 +256,9 @@ export default async function EditPostPage(props: { params: Promise<{ id: string
235
256
  <PostForm
236
257
  post={postWithBlocks as PostType & { feature_image_id?: string | null }}
237
258
  formAction={updatePostWithId}
259
+ // Read-only: the form never writes blocks, it only lets Cortex AI read them so it
260
+ // can summarize the article when drafting meta title and description.
261
+ contentBlocks={postWithBlocks.blocks}
238
262
  actionButtonText="Update Post Metadata"
239
263
  isEditing={true}
240
264
  availableLanguagesProp={allSiteLanguages}
@@ -242,6 +266,14 @@ export default async function EditPostPage(props: { params: Promise<{ id: string
242
266
  initialFeatureImageId={initialFeatureImageIdProp}
243
267
  />
244
268
 
269
+ {/*
270
+ Between the metadata form and the blocks because that is exactly what
271
+ it grades: everything above it and everything below it, together. It
272
+ collapses to a single summary row so the block editor keeps its place
273
+ on the screen.
274
+ */}
275
+ <PageSeoAuditSection />
276
+
245
277
  <Separator className="my-8" />
246
278
 
247
279
  <div className="w-full mx-auto px-6">
@@ -254,6 +286,7 @@ export default async function EditPostPage(props: { params: Promise<{ id: string
254
286
  />
255
287
  </div>
256
288
  </div>
289
+ </PageSeoProvider>
257
290
  </UploadFolderProvider>
258
291
  );
259
292
  }