Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
fix(content): name the team in the page's language in Send to CMS's author field, as Export does (#1455)
Cihan79e7c1133d31
diff --git a/docs/api-reference/webhooks.mdx b/docs/api-reference/webhooks.mdxindex b4ac026b4..744a159d1 100644--- a/docs/api-reference/webhooks.mdx+++ b/docs/api-reference/webhooks.mdx@@ -243,7 +243,7 @@ One request per page:- `delivery.batchId` is shared by the pages sent in one request of several pages (a bulk send); it is `null` for a page sent on its own.- `page.html` is the page ready to publish, as **Export** gives it: placeholders filled, without its H1 (the title field carries it), with the brand's byline line when it adds the byline to its content. Ansvisor cleans it once more before sending: no scripts except JSON-LD, no frames, forms or event handlers, and links only to `http`, `https`, `mailto`, `tel` or relative addresses (images may also be `data:image/…`).- `page.jsonLd` is the page's JSON-LD, each block parsed, or `[]`. Many CMS rich-text fields drop `<script>` from `page.html`, so add these to the post's head or its schema field.-- `page.metaTitle` is the title when none was set. `page.author` is the page's author or the brand's team byline, or `null`. `page.featuredImage` is the page's first `https` image, or `null`.+- `page.metaTitle` is the title when none was set. `page.author` is the page's author, or the brand's team named in the page's language ("Acme Team", "Acme Ekibi"; the brand's name alone for a language without a wording), or `null`. `page.featuredImage` is the page's first `https` image, or `null`.- `page.method` is `create` for a new page and `optimize` for one made from a live page, whose address is `page.sourceUrl` (otherwise `null`): update that post rather than creating another. `page.pageType` is the page's type in the editor (`blog_post`, `guide`, `comparison`…), or `null`.- `page.language` is a two-letter code: the page's **Language** rule when it is on (the workspace's **My rules** for a page whose rules no one has changed), otherwise the brand's language, otherwise `en`.- `callback_url` and `callback_method` are `null` when the webhook has no secret key.diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsxindex 23ee5b599..5f56c5c55 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx@@ -2547,8 +2547,9 @@ export function DraftEditor({html={sendOpen.html}sourceUrl={draft.sourceUrl}author={pageAuthor}- // Until the authors are read, who it is by isn't known.- teamByline={authorsRead ? t('author.organization', { brand: brandName }) : ''}+ // Until the authors are read, who it is by isn't known. It goes to+ // the CMS's author field, so in the page's language, as Export's.+ teamByline={authorsRead ? teamName(language, brandName) : ''}byline={contentByline}onFillNow={() => {setSendOpen(null);diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsxindex 57e4f8cf7..ee3c7185e 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx@@ -3299,6 +3299,23 @@ describe('the side panel', () => {expect(dialog()).toBeNull();});+ it('names the team in the page’s language in the CMS author field, as Export does', async () => {+ process.env.NEXT_PUBLIC_CONTENT_QUALITY_PHASE = '1';+ brandState.brands = [{ id: 'b1', language: 'tr' } as never, { id: 'b2' }];+ try {+ getContentDraft.mockResolvedValue(draft({ pageType: 'blog_post' }));+ await renderPage();+ await act(async () => button('Send to CMS')!.click());+ await act(async () => inDialog('Continue to send').click());+ await act(async () => inDialog('Send').click());+ expect(sendPagesToCms).toHaveBeenCalledWith('b1', [+ expect.objectContaining({ draftId: 'd1', author: 'Acme Ekibi' }),+ ]);+ } finally {+ brandState.brands = [{ id: 'b1' }, { id: 'b2' }];+ }+ });+it('opens Before you publish first while Quality is on', async () => {process.env.NEXT_PUBLIC_CONTENT_QUALITY_PHASE = '1';getContentDraft.mockResolvedValue(draft({ pageType: 'blog_post' }));diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/library/_bulk-send-dialog.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/library/_bulk-send-dialog.tsxindex 8d91f969a..3db445900 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/library/_bulk-send-dialog.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/library/_bulk-send-dialog.tsx@@ -119,7 +119,6 @@ export function BulkSendDialog({draftIds: ids,brandName,brandLanguage,- teamByline: (brand) => tEditor('author.organization', { brand }),}),readKeptFields(ids),])diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/library/_cms-sources.ts b/web/src/app/[locale]/(dashboard)/dashboard/content/library/_cms-sources.tsindex d4ad5a98b..74b44075c 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/library/_cms-sources.ts+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/library/_cms-sources.ts@@ -6,7 +6,8 @@ import { qualityPhase } from '@/lib/content/quality';/*** Library pages for Send to CMS (#1331), made ready as the editor makes its- * own: their author and the brand's byline line once Quality is live. Read a+ * own: their author, the team and the brand's byline line in the page's+ * language once Quality is live. Read a* slice at a time, as the Library's Export reads them; a page gone meanwhile* is left out.*/@@ -15,13 +16,11 @@ export async function readCmsSources({draftIds,brandName,brandLanguage,- teamByline,}: {brandId: string;draftIds: string[];brandName: string;brandLanguage: string | null | undefined;- teamByline: (brand: string) => string;}): Promise<Map<string, CmsSource>> {const readPages = async () => {const pages: DraftPage[] = [];@@ -47,7 +46,6 @@ export async function readCmsSources({brandId,brandName: name,brandLanguage,- teamByline: teamByline(name),}),]),);diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/library/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/library/page.tsxindex d43e89594..4656e3c81 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/library/page.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/library/page.tsx@@ -76,7 +76,6 @@ interface LibraryRead {*/export default function ContentLibraryPage() {const t = useTranslations('contentEditor.library');- const tEditor = useTranslations('contentEditor.editor');const router = useRouter();const activeBrandId = useBrandStore((s) => s.activeBrandId);const activeBrand = useBrandStore((s) => s.brands.find((b) => b.id === s.activeBrandId));@@ -203,7 +202,6 @@ export default function ContentLibraryPage() {draftIds: [draft.id],brandName: activeBrand?.name ?? '',brandLanguage: activeBrand?.language,- teamByline: (brand) => tEditor('author.organization', { brand }),}).then((sources) => sources.get(draft.id) ?? null,(err) => {diff --git a/web/src/components/content/send-to-cms-dialog.tsx b/web/src/components/content/send-to-cms-dialog.tsxindex b575b2f9d..6c7389a7c 100644--- a/web/src/components/content/send-to-cms-dialog.tsx+++ b/web/src/components/content/send-to-cms-dialog.tsx@@ -62,7 +62,7 @@ export function SendDialog({html: string;sourceUrl: string | null;author: ContentAuthor | null;- /** The team byline; empty while the authors aren't read. */+ /** The brand's team in the page's language (teamName); empty while the authors aren't read. */teamByline: string;/** The byline line the brand puts in the content, or null. */byline: string | null;diff --git a/web/src/lib/content/cms-send.test.ts b/web/src/lib/content/cms-send.test.tsindex ea935cdb5..285b75a6a 100644--- a/web/src/lib/content/cms-send.test.ts+++ b/web/src/lib/content/cms-send.test.ts@@ -193,7 +193,6 @@ describe('cmsSource', () => {brandId: 'b1',brandName: 'Acme',brandLanguage: 'en',- teamByline: 'Acme Team',...over,});@@ -220,6 +219,17 @@ describe('cmsSource', () => {).toBe('Vom Acme-Team');});+ it('names the team in the page’s language, for the CMS’s author field, as Export does', () => {+ expect(source({ brandLanguage: 'tr' }).teamByline).toBe('Acme Ekibi');+ expect(source({ page: { ...stored, language: 'German' } }).teamByline).toBe('Acme-Team');+ // The page's own language over a brand's that isn't English.+ expect(+ source({ brandLanguage: 'tr', page: { ...stored, language: 'German' } }).teamByline,+ ).toBe('Acme-Team');+ // No brand name read: no team to name.+ expect(source({ brandName: '' }).teamByline).toBe('');+ });+it('gives no author or team byline while Quality is off', () => {expect(source({ authors: null })).toMatchObject({ author: null, teamByline: '', byline: null });});diff --git a/web/src/lib/content/cms-send.ts b/web/src/lib/content/cms-send.tsindex cfce6968a..021f1cd2e 100644--- a/web/src/lib/content/cms-send.ts+++ b/web/src/lib/content/cms-send.ts@@ -6,6 +6,7 @@ import {exportPlaceholders,fragment,pageFields,+ teamName,titlePlaceholders,withByline,withoutLeadingH1,@@ -119,7 +120,10 @@ export interface CmsSource {html: string;sourceUrl: string | null;author: ContentAuthor | null;- /** The team byline; empty while the authors aren't read. */+ /**+ * The brand's team in the page's language, for the CMS's author field when+ * the page has no author (teamName); empty while the authors aren't read.+ */teamByline: string;/** The byline line the brand puts in the content, or null. */byline: string | null;@@ -127,10 +131,11 @@ export interface CmsSource {/*** A Library row's page for Send to CMS, as the editor gives its own: the- * stored page made publishable, its author and the brand's byline line in- * the page's language (its own Language rule, else the brand's; a- * workspace's My rules for the type aren't read here). `authors` is null- * while Quality is off, as the editor reads none then.+ * stored page made publishable, its author, the team for the CMS's author+ * field as Export names it, and the brand's byline line, both in the page's+ * language (its own Language rule, else the brand's; a workspace's My rules+ * for the type aren't read here). `authors` is null while Quality is off,+ * as the editor reads none then.*/export function cmsSource({page,@@ -138,15 +143,14 @@ export function cmsSource({brandId,brandName,brandLanguage,- teamByline,}: {page: DraftPage;authors: AuthorsRead | null;brandId: string;brandName: string;brandLanguage: string | null | undefined;- teamByline: string;}): CmsSource {+ const language = page.language ?? brandLanguage;const author = authors?.authors.find((a) => a.id === page.authorId) ?? null;const inContent = authors?.brands.find((b) => b.id === brandId)?.bylineInContent ?? false;return {@@ -155,10 +159,8 @@ export function cmsSource({html: publishableHtml(page.bodyHtml),sourceUrl: page.sourceUrl,author,- teamByline: authors ? teamByline : '',- byline: inContent- ? bylineText(page.language ?? brandLanguage, author?.name ?? null, brandName)- : null,+ teamByline: authors ? teamName(language, brandName) : '',+ byline: inContent ? bylineText(language, author?.name ?? null, brandName) : null,};}