feat: SEO SPA editor integration

This commit is contained in:
Florian Sylvain committed 2026-10-16 03:06:57 +02:00
1 parent eb9876fde3
commit 470584400f
62 files changed
+7471 -58

No files matched your search

+17
View File
@@ -9,6 +9,7 @@ import type { Article, Byline } from '@/composables/useArticles'
import type { Author } from '@/composables/useAuthors'
import type { Site } from '@/composables/useSites'
import { DESKTOP_WIDTH, setViewportWidth } from '@/components/__tests__/viewport'
import { SEO_KEYS } from '@/lib/articleSeo'
import { slugify } from '@/lib/directory'
import { useSessionStore } from '@/stores/session'
import {
@@ -42,6 +43,14 @@ export interface MetaBackend extends Backend {
meSlugAdjusted?: boolean
}
export function readyCheck() {
return {
status: 'ready',
suggestions: [],
slug: { available: true, suggestion: null },
}
}
export const MARTA_EMAIL = 'marta@renew.example'
const ARTICLE_ID = 12
@@ -146,6 +155,11 @@ function patchArticle(backend: MetaBackend, body: Record<string, unknown>) {
if (typeof body.body === 'string') {
backend.article.body = body.body
}
for (const key of SEO_KEYS) {
if (key in body) {
Object.assign(backend.article, { [key]: body[key] })
}
}
return structuredClone(backend.article)
}
@@ -206,6 +220,9 @@ function createMyAuthor(backend: MetaBackend) {
function route(backend: MetaBackend, call: Call): unknown {
const { method, path, query, body } = call
const articleMatch = /^\/v1\/article\/(\d+)$/.exec(path)
if (/^\/v1\/article\/\d+\/seo\/check$/.test(path) && method === 'POST') {
return readyCheck()
}
if (articleMatch && method === 'GET') {
return structuredClone(backend.article)
}