Skip to content

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.

fix(content): Export's link row as Before you publish reads it, its checks memoized, and the team named in the page's language (#1427 follow-up) (#1445)

Cihan0112ff80574a
diff --git a/web/messages/en.json b/web/messages/en.json
index fac6df714..3475912ae 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -4320,8 +4320,9 @@
"okDetail": "Each was read in the last day.",
"broken": "{broken} of {count} links don't answer",
"brokenDetail": "Fix or remove them first: Quality shows which.",
- "reading": "{count, plural, one {# link} other {# links}}, still being read",
+ "reading": "{reading} of {count} links still being read",
"readingDetail": "Their read comes a few seconds after the page is saved.",
+ "readingAndUnread": "{reading} of {count} links still being read, {unread} couldn't be read",
"unread": "{unread} of {count} links couldn't be read",
"unreadDetail": "Open them yourself before you publish."
},
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.test.tsx
index 004050a4d..be8367689 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.test.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.test.tsx
@@ -73,6 +73,7 @@ function quality(over: Partial<QualityRead> = {}): QualityRead {
canEdit: true,
hasAuthors: true,
brandName: 'Acme',
+ team: 'Acme Team',
siteTrust,
todos: qualityTodos({ eeat: score, author, hasAuthors: true, canEdit: true }),
...over,
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.tsx
index eace0bdd7..b375b5a10 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.tsx
@@ -103,7 +103,6 @@ export function BeforePublish({
}) {
const t = useTranslations('contentEditor.editor.beforePublish');
const tQuality = useTranslations('contentEditor.editor.quality');
- const tAuthor = useTranslations('contentEditor.editor.author');
const markRef = useRef<HTMLButtonElement>(null);
// Fix first and Fill now move on to the page: focus isn't sent back to the button.
const fixing = useRef(false);
@@ -150,9 +149,7 @@ export function BeforePublish({
: {
state: 'missing',
title: t('author.none'),
- detail: t('author.noneDetail', {
- byline: tAuthor('organization', { brand: brandName }),
- }),
+ detail: t('author.noneDetail', { byline: quality.team }),
},
...(article
? [
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.tsx
index 4454c685b..926203dc5 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
@@ -86,6 +86,7 @@ import {
bylineText,
exportPlaceholders,
pasteChecks,
+ teamName,
titlePlaceholders,
withByline,
} from '@/lib/content/ready-to-publish';
@@ -574,6 +575,7 @@ export function DraftEditor({
canEdit: canEditPageAuthor,
hasAuthors,
brandName,
+ team: teamName(language, brandName),
siteTrust,
todos,
}
@@ -1416,6 +1418,11 @@ export function DraftEditor({
} | null>(null);
const openExport = (destination?: ExportDestination) =>
setExportOpen({ html: pageToPublish(), destination });
+ // Its checks, read again only as the link reads land, not on every render.
+ const exportChecks = useMemo(
+ () => (exportOpen ? pasteChecks(exportOpen.html, linkChecks) : null),
+ [exportOpen, linkChecks],
+ );
const copyPageHtml = () => {
if (!editor) return;
const html = pageToPublish();
@@ -2327,7 +2334,7 @@ export function DraftEditor({
)}
</div>
- {quality && exportOpen && (
+ {quality && exportOpen && exportChecks && (
<ExportDialog
onClose={() => setExportOpen(null)}
title={title}
@@ -2335,10 +2342,11 @@ export function DraftEditor({
isNew={draft.method === 'create'}
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.
+ teamByline={authorsRead ? teamName(language, brandName) : ''}
byline={contentByline}
- checks={pasteChecks(exportOpen.html, linkChecks)}
+ checks={exportChecks}
linksPending={linksPending}
initialDestination={exportOpen.destination}
onFillNow={() => {
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.test.tsx
index 8d02715a4..bb1fbe8c2 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.test.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.test.tsx
@@ -205,7 +205,8 @@ describe('ExportDialog', () => {
},
linksPending: 2,
});
- expect(dialog().textContent).toContain('3 links, still being read');
+ // Two of the three unread, both of them still coming.
+ expect(dialog().textContent).toContain('2 of 3 links still being read');
expect(dialog().textContent).not.toContain('alt text');
expect(dialog().textContent).toContain(
'HTML blocks keep their own code · check it2 elements keep a class, a style or a script',
@@ -221,6 +222,30 @@ describe('ExportDialog', () => {
});
expect(dialog().textContent).toContain("1 of 1 links couldn't be read");
expect(dialog().textContent).not.toContain('answers');
+ // One read still coming for two unread: the other couldn't be read.
+ await render({
+ html: '<p>Done.</p>',
+ checks: {
+ links: { count: 3, read: 1, broken: 0 },
+ images: { count: 0, withoutAlt: 0 },
+ ownCode: 0,
+ },
+ linksPending: 1,
+ });
+ expect(dialog().textContent).toContain(
+ "1 of 3 links still being read, 1 couldn't be read · check itOpen them yourself before you publish.",
+ );
+ // More reads coming than links unread (another page's): only the unread are.
+ await render({
+ html: '<p>Done.</p>',
+ checks: {
+ links: { count: 3, read: 2, broken: 0 },
+ images: { count: 0, withoutAlt: 0 },
+ ownCode: 0,
+ },
+ linksPending: 4,
+ });
+ expect(dialog().textContent).toContain('1 of 3 links still being read · check it');
});
it('gives the page fields, each with Copy', async () => {
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.tsx
index b8a5d351d..990e2397d 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.tsx
@@ -257,6 +257,10 @@ export function ExportDialog({
];
if (checks.links.count) {
const { count, read, broken } = checks.links;
+ // The reads still coming are for some of the unread links at most, as
+ // Before you publish counts them: the rest couldn't be read.
+ const reading = Math.min(linksPending, count - read);
+ const notRead = count - read - reading;
rows.push(
broken
? {
@@ -264,24 +268,30 @@ export function ExportDialog({
title: t('checks.links.broken', { broken, count }),
detail: t('checks.links.brokenDetail'),
}
- : read < count && linksPending
+ : reading && notRead
? {
state: 'check',
- title: t('checks.links.reading', { count }),
- detail: t('checks.links.readingDetail'),
+ title: t('checks.links.readingAndUnread', { reading, unread: notRead, count }),
+ detail: t('checks.links.unreadDetail'),
}
- : read < count
+ : reading
? {
- // Some couldn't be read: no word on whether they answer.
state: 'check',
- title: t('checks.links.unread', { unread: count - read, count }),
- detail: t('checks.links.unreadDetail'),
+ title: t('checks.links.reading', { reading, count }),
+ detail: t('checks.links.readingDetail'),
}
- : {
- state: 'ok',
- title: t('checks.links.ok', { count }),
- detail: t('checks.links.okDetail'),
- },
+ : notRead
+ ? {
+ // Some couldn't be read: no word on whether they answer.
+ state: 'check',
+ title: t('checks.links.unread', { unread: notRead, count }),
+ detail: t('checks.links.unreadDetail'),
+ }
+ : {
+ state: 'ok',
+ title: t('checks.links.ok', { count }),
+ detail: t('checks.links.okDetail'),
+ },
);
}
if (checks.images.count) {
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_next-nudge.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_next-nudge.test.tsx
index 5ea0127c2..09469ae3f 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_next-nudge.test.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_next-nudge.test.tsx
@@ -55,7 +55,7 @@ function Harness({ todos, author }: { todos: QualityTodo[]; author: ContentAutho
))}
<NextNudge
shown={nudge.shown}
- quality={{ author, brandName: 'Acme', canEdit: true }}
+ quality={{ author, team: 'Acme Team', canEdit: true }}
onShowPlaceholder={onShowPlaceholder}
onPickAuthor={onPickAuthor}
onLater={nudge.later}
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_next-nudge.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_next-nudge.tsx
index ac48ffc7c..18cbf2e5d 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_next-nudge.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_next-nudge.tsx
@@ -93,7 +93,7 @@ export function NextNudge({
onAct,
}: {
shown: { todo: QualityTodo; count: number } | null;
- quality: Pick<QualityRead, 'author' | 'brandName' | 'canEdit'>;
+ quality: Pick<QualityRead, 'author' | 'team' | 'canEdit'>;
/** Selects the page's first placeholder, to type over. */
onShowPlaceholder: () => void;
onPickAuthor: () => void;
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsx
index 34a159050..9ac8edb34 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsx
@@ -77,6 +77,7 @@ function read(
canEdit,
hasAuthors,
brandName: 'Acme',
+ team: 'Acme Team',
siteTrust: null,
todos: qualityTodos({ eeat: score, author, hasAuthors, canEdit }),
};
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx
index 3522ae4f8..064e45e9f 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx
@@ -41,6 +41,8 @@ export interface QualityRead {
/** Whether the workspace has an author to pick (Settings › Authors). */
hasAuthors: boolean;
brandName: string;
+ /** The brand's team as the page goes out without an author, in its language (teamName). */
+ team: string;
/** The site's trust in Site Audit (CE-043), or null while not read. */
siteTrust: SiteTrust | null;
/** What only the person can do (qualityTodos, CE-040). */
@@ -219,10 +221,9 @@ export function QualityTab({
/** A to-do's words: its title, the nudge's "Next for you" phrase and its detail line. */
export function useTodoCopy() {
const t = useTranslations('contentEditor.editor.quality.todos');
- const tAuthor = useTranslations('contentEditor.editor.author');
return (
todo: QualityTodo,
- { author, brandName, canEdit }: Pick<QualityRead, 'author' | 'brandName' | 'canEdit'>,
+ { author, team, canEdit }: Pick<QualityRead, 'author' | 'team' | 'canEdit'>,
) => {
if (todo.id === 'placeholders') {
const count = todo.count ?? 0;
@@ -242,9 +243,7 @@ export function useTodoCopy() {
? t('byline.done', { name: author.name })
: action === 'addAuthor'
? t('byline.detail.addAuthor')
- : t('byline.detail.pickAuthor', {
- byline: tAuthor('organization', { brand: brandName }),
- }),
+ : t('byline.detail.pickAuthor', { byline: team }),
};
}
if (!author) {
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.tsx
index 2fab8068c..76c408b05 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
@@ -2999,6 +2999,19 @@ describe('the side panel', () => {
expect(inDialog('Copy for Webflow').disabled).toBe(false);
});
+ it('names the team in the page’s language in the CMS author field', async () => {
+ brandState.brands = [{ id: 'b1', language: 'tr' } as never, { id: 'b2' }];
+ try {
+ getContentDraft.mockResolvedValue(draft({ pageType: 'blog_post' }));
+ await renderPage();
+ await act(async () => button('Export')!.click());
+ await act(async () => inDialog('Continue to export').click());
+ expect(dialog()!.textContent).toContain('AuthorAcme Ekibi → your CMS author field');
+ } finally {
+ brandState.brands = [{ id: 'b1' }, { id: 'b2' }];
+ }
+ });
+
it('reads Ready to paste as the links are read, a refused read as unread', async () => {
vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
try {
diff --git a/web/src/lib/content/ready-to-publish.test.ts b/web/src/lib/content/ready-to-publish.test.ts
index 5f883022a..368350526 100644
--- a/web/src/lib/content/ready-to-publish.test.ts
+++ b/web/src/lib/content/ready-to-publish.test.ts
@@ -9,6 +9,7 @@ import {
fragment,
pageFields,
pasteChecks,
+ teamName,
titlePlaceholders,
withByline,
withoutLeadingH1,
@@ -324,6 +325,19 @@ describe('withByline', () => {
});
});
+describe('teamName', () => {
+ it('names the team in the page’s language, the brand alone in another', () => {
+ expect(teamName(null, 'Acme')).toBe('Acme Team');
+ expect(teamName('tr', 'Acme')).toBe('Acme Ekibi');
+ expect(teamName('German', 'Acme')).toBe('Acme-Team');
+ expect(teamName('pt-BR', 'Acme')).toBe('Equipe Acme');
+ expect(teamName('ja', 'Acme')).toBe('Acme');
+ // A "$" in the name is written as it is; no brand read yet, no team.
+ expect(teamName('en', 'Cash $1')).toBe('Cash $1 Team');
+ expect(teamName('de', ' ')).toBe('');
+ });
+});
+
describe('bylineText', () => {
it("writes the line in the brand's language, by the author or the brand's team", () => {
expect(bylineText(null, 'Ada Lovelace', 'Acme')).toBe('By Ada Lovelace');
diff --git a/web/src/lib/content/ready-to-publish.ts b/web/src/lib/content/ready-to-publish.ts
index e22c06bd6..93d4d2c9c 100644
--- a/web/src/lib/content/ready-to-publish.ts
+++ b/web/src/lib/content/ready-to-publish.ts
@@ -432,20 +432,21 @@ export function pageFields({
/**
* The byline line in the page's language (Add byline to content): the
- * prefix with the author's name, or the team's line. It goes into the page,
- * so it is written in the page's language, not the app's. A language not
- * here gets the name alone, or the brand's.
+ * prefix with the author's name, or the team's line; and the team's name
+ * alone, for a CMS's author field. They go out with the page, so they are
+ * written in the page's language, not the app's. A language not here gets
+ * the name alone, or the brand's.
*/
-const BYLINES: Record<string, { by: string; team: string }> = {
- en: { by: 'By {name}', team: 'By {brand} Team' },
- tr: { by: 'Yazar: {name}', team: 'Yazar: {brand} Ekibi' },
- de: { by: 'Von {name}', team: 'Vom {brand}-Team' },
- fr: { by: 'Par {name}', team: "Par l'équipe {brand}" },
- es: { by: 'Por {name}', team: 'Por el equipo de {brand}' },
- pt: { by: 'Por {name}', team: 'Pela equipe {brand}' },
- it: { by: 'Di {name}', team: 'A cura del team {brand}' },
- nl: { by: 'Door {name}', team: 'Door het {brand}-team' },
- sv: { by: 'Av {name}', team: 'Av {brand}-teamet' },
+const BYLINES: Record<string, { by: string; team: string; teamName: string }> = {
+ en: { by: 'By {name}', team: 'By {brand} Team', teamName: '{brand} Team' },
+ tr: { by: 'Yazar: {name}', team: 'Yazar: {brand} Ekibi', teamName: '{brand} Ekibi' },
+ de: { by: 'Von {name}', team: 'Vom {brand}-Team', teamName: '{brand}-Team' },
+ fr: { by: 'Par {name}', team: "Par l'équipe {brand}", teamName: 'Équipe {brand}' },
+ es: { by: 'Por {name}', team: 'Por el equipo de {brand}', teamName: 'Equipo de {brand}' },
+ pt: { by: 'Por {name}', team: 'Pela equipe {brand}', teamName: 'Equipe {brand}' },
+ it: { by: 'Di {name}', team: 'A cura del team {brand}', teamName: 'Team {brand}' },
+ nl: { by: 'Door {name}', team: 'Door het {brand}-team', teamName: '{brand}-team' },
+ sv: { by: 'Av {name}', team: 'Av {brand}-teamet', teamName: '{brand}-teamet' },
};
/**
@@ -463,6 +464,18 @@ export function bylineText(
return forms ? forms.team.replace('{brand}', () => brand) : brand;
}
+/**
+ * The brand's team as a page in `language` names it, for a CMS's author
+ * field when the page has no author ("Acme Team", "Acme Ekibi"); the brand
+ * alone in a language not here.
+ */
+export function teamName(language: string | null | undefined, brand: string): string {
+ // No brand read yet: no team to name.
+ if (!brand.trim()) return '';
+ const forms = BYLINES[languageCode(language) ?? ''];
+ return forms ? forms.teamName.replace('{brand}', () => brand) : brand;
+}
+
/**
* Where the end tag of the HTML's k-th H1 ends, counted from 0, or null.
* Comments and code are blanked first (blankCode): an H1 there is no element.