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.

feat(content-editor): weigh Quality's checks by the page type, and say which (CE-052, part a) (#1491)

Cihanbe0808b797eb
diff --git a/web/.env.example b/web/.env.example
index 933c764a3..ea420ca61 100644
--- a/web/.env.example
+++ b/web/.env.example
@@ -64,7 +64,8 @@ NEXT_PUBLIC_ACTION_TASKS_AI=
# for none. 1 shows Instructions › Quality and the header's Quality chip.
# 2 adds the AI checks, starting with the site type picked in the editor
# (CE-056); set the server's CONTENT_QUALITY_PHASE to the same value, so the
-# Content Agent is told it too.
+# Content Agent is told it too. 3 weighs the checks by the page's type (a
+# product page has no author, a comparison wants balance; CE-052).
# -----------------------------------------------------------------------------
NEXT_PUBLIC_CONTENT_QUALITY_PHASE=
diff --git a/web/messages/en.json b/web/messages/en.json
index 31d753049..eed6844c2 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -4599,7 +4599,9 @@
"none": "No author yet",
"noneDetail": "The page goes out as {byline}, with the brand's Organization schema. A real author raises E-E-A-T.",
"confirmed": "Author named on your site",
- "confirmedDetail": "You confirmed the page's author is a real person your site names. Check your CMS sets them as the author."
+ "confirmedDetail": "You confirmed the page's author is a real person your site names. Check your CMS sets them as the author.",
+ "brand": "Your brand's byline",
+ "brandDetail": "This page type goes out under {byline}: it needs no author."
},
"dates": {
"title": "Visible published and updated dates",
@@ -4698,6 +4700,17 @@
"needsWork": "Needs work"
},
"estimate": "Ansvisor estimates based on Google's published quality signals. Not a Google score.",
+ "weightsFor": {
+ "line": "Checks and weights for {type}{detected, select, yes { (detected)} other {}}:",
+ "noType": "an article (no page type yet)",
+ "change": "Change",
+ "changeLabel": "Change the page type",
+ "article": "an author with experience, sourced claims, short sentences and the answer first.",
+ "product": "no author (your brand's), your own product photos, proof for claims, prices that match, short plain copy.",
+ "category": "your own product images, your brand's information on its site, prices and claims that match.",
+ "feature": "your own screenshots and data, sourced metrics, a price that matches, scannable sections.",
+ "comparison": "an author who says how the picks were made, balance and a disclosure, the summary first."
+ },
"tooShort": "Write a few paragraphs: Readability is read from the page as you write.",
"tooShortShort": "Too short yet",
"notScored": "Not scored yet",
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 eb4018e0d..d0428e3c3 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
@@ -309,6 +309,38 @@ describe('BeforePublish', () => {
expect(jsonLd()).not.toHaveProperty('author');
});
+ it('asks a product page for no disclosure: it is the brand’s own (CE-052)', async () => {
+ const recommends = {
+ aiChecks: {
+ how: null,
+ balanced: null,
+ disclosure: { found: false, show: 'Acme Ridge is our pick' },
+ answerFirst: null,
+ },
+ };
+ await render(quality(recommends));
+ expect(rows().some((row) => row.includes('without a disclosure'))).toBe(true);
+ await render(
+ quality({
+ ...recommends,
+ weightsFor: { type: 'product_page', detected: false, profile: 'product' },
+ }),
+ );
+ expect(rows().some((row) => row.includes('without a disclosure'))).toBe(false);
+ });
+
+ it('names the brand’s byline as checked on a page type that wants no author (CE-052)', async () => {
+ await render(
+ quality({
+ author: null,
+ weightsFor: { type: 'product_page', detected: false, profile: 'product' },
+ }),
+ );
+ expect(rows()[0]).toBe(
+ "Your brand's byline · check itThis page type goes out under Acme Team: it needs no author.",
+ );
+ });
+
it('names the team byline as missing, and keeps a live page its published date', async () => {
await render(quality({ author: null }), { isNew: false, image: null });
const [author, , schema] = rows();
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 4d84431a5..7a39f1fcf 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
@@ -18,6 +18,7 @@ import {
localDate,
titleHasPlaceholder,
} from '@/lib/content/page-schema';
+import { checksOff } from '@/lib/content/quality-profiles';
import { cn } from '@/lib/utils';
import { copyToClipboard } from './_html-block';
import { trustSuggestions, type QualityRead } from './_quality-tab';
@@ -165,7 +166,11 @@ export function BeforePublish({
: null;
// Added here: it counts once the page is read again.
const [added, setAdded] = useState(false);
- const disclosure = quality.aiChecks?.disclosure ?? null;
+ // Where the page's type counts it (CE-052): a product page is the brand's own.
+ const disclosure =
+ quality.weightsFor && checksOff(quality.weightsFor.profile).has('disclosure')
+ ? null
+ : (quality.aiChecks?.disclosure ?? null);
const brand = quality.brandName || tQuality('yourBrand');
const rows: Row[] = [
!authorsRead
@@ -181,11 +186,18 @@ export function BeforePublish({
: quality.authorConfirmed?.real
? // The person confirmed the author their site names (00271).
{ state: 'check', title: t('author.confirmed'), detail: t('author.confirmedDetail') }
- : {
- state: 'missing',
- title: t('author.none'),
- detail: t('author.noneDetail', { byline: quality.team }),
- },
+ : quality.weightsFor && checksOff(quality.weightsFor.profile).has('byline')
+ ? // A page type that goes out under the brand (CE-052): a product page.
+ {
+ state: 'check',
+ title: t('author.brand'),
+ detail: t('author.brandDetail', { byline: quality.team }),
+ }
+ : {
+ state: 'missing',
+ title: t('author.none'),
+ detail: t('author.noneDetail', { byline: quality.team }),
+ },
...(article
? [
{ state: 'check' as const, title: t('dates.title'), detail: t('dates.detail') },
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 129b28c6f..c7b9bdf03 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
@@ -114,6 +114,14 @@ import {
unplacedSites,
type ClaimMark,
} from '@/lib/content/quality-checks';
+import {
+ PROFILE_WEIGHTS,
+ checksOff,
+ profileFor,
+ waitsForSiteTrust,
+ weighed,
+ weighedTrust,
+} from '@/lib/content/quality-profiles';
import { proofKey, qualityTodos } from '@/lib/content/quality-todos';
import { isByline, readability, sentencesOf } from '@/lib/content/readability';
import { brandFactsPath, factMismatches } from '@/lib/content/brand-facts';
@@ -741,9 +749,19 @@ export function DraftEditor({
language,
brandName,
]);
+ // Phase 3 (CE-052): what the scores count, and how much, follows the
+ // page's type (an article's before, and for most types).
+ const profile = profileFor(pageType);
+ const weights = PROFILE_WEIGHTS[profile];
const readable = useMemo(
- () => (qualityOn ? readability(pageHtml, language, aiChecks?.answerFirst ?? null) : null),
- [qualityOn, pageHtml, language, aiChecks],
+ () =>
+ qualityOn
+ ? weighed(
+ readability(pageHtml, language, aiChecks?.answerFirst ?? null),
+ weights.readability,
+ )
+ : null,
+ [qualityOn, pageHtml, language, aiChecks, weights],
);
// A proof to-do asked for this session stays, checked once it has a link.
const [hadProofs, setHadProofs] = useState<ReadonlySet<string>>(() => new Set());
@@ -787,17 +805,24 @@ export function DraftEditor({
// E-E-A-T from the author (and, in phase 2, the person's experience and
// data, and their own images); with Trust and Readability, the scores and
// the header chip's average (CE-039).
- // In phase 2 it waits for the visual proof too, so it doesn't move once that lands.
+ // In phase 2 it waits for the visual proof too, so it doesn't move once that lands;
+ // on a type that weighs the brand's own information, for the site's trust.
+ const brandInfoRead = !waitsForSiteTrust(profile) || siteTrustRead;
const eeatScore = useMemo(
() =>
- qualityOn && authorsRead && !inputsPending && (!sourcesOn || visualRead)
- ? eeat({
- author: pageAuthor,
- used,
- visual,
- how: aiChecks?.how ?? null,
- confirmed: authorConfirmed,
- })
+ qualityOn && authorsRead && !inputsPending && (!sourcesOn || visualRead) && brandInfoRead
+ ? weighed(
+ eeat({
+ author: pageAuthor,
+ used,
+ visual,
+ how: aiChecks?.how ?? null,
+ confirmed: authorConfirmed,
+ // The brand's own information: only a type that weighs it counts it.
+ siteTrust,
+ }),
+ weights.eeat,
+ )
: null,
[
qualityOn,
@@ -810,6 +835,9 @@ export function DraftEditor({
visual,
aiChecks,
authorConfirmed,
+ siteTrust,
+ brandInfoRead,
+ weights,
],
);
// A page that advises consumers on health, finance or law (the page's read)
@@ -862,21 +890,25 @@ export function DraftEditor({
const trustScore = useMemo(
() =>
qualityOn && brandDomains && !inputsPending
- ? trust({
- blocks: pageBlocks,
- links: linkChecks,
- brandDomains,
- siteTrust,
- quote: used ? used.quote : null,
- sources: sourceRead,
- claims: claimBlocks,
- brandFacts: factCheck,
- proofs: proofAsks,
- page: aiChecks,
- now: Date.now(),
- })
+ ? weighedTrust(
+ trust({
+ blocks: pageBlocks,
+ links: linkChecks,
+ brandDomains,
+ siteTrust,
+ quote: used ? used.quote : null,
+ sources: sourceRead,
+ claims: claimBlocks,
+ brandFacts: factCheck,
+ proofs: proofAsks,
+ page: aiChecks,
+ now: Date.now(),
+ }),
+ weights.trust,
+ )
: null,
[
+ weights,
qualityOn,
pageBlocks,
linkChecks,
@@ -1012,10 +1044,15 @@ export function DraftEditor({
// Once the authors are read: who the reviewer is, and whether any can be.
reviewer: regulated && authorsRead ? { topic: regulated, picked: !!pageReviewer } : null,
confirmed: authorConfirmed,
+ off: checksOff(profile),
})
: [];
const quality: QualityRead | null = qualityOn
? {
+ weightsFor:
+ qualityPhase() >= 3
+ ? { type: pageType ?? null, detected: picked === null, profile }
+ : null,
readability: readable,
eeat: eeatScore,
trust: trustScore,
@@ -1043,6 +1080,8 @@ export function DraftEditor({
: null;
// Quality's Pick author opens the header's menu.
const [authorMenuOpen, setAuthorMenuOpen] = useState(false);
+ // Quality's Change opens the header's page type menu (CE-052).
+ const [typeMenuOpen, setTypeMenuOpen] = useState(false);
// Quality's Pick reviewer opens its menu beside the author's (CE-049).
const [reviewerMenuOpen, setReviewerMenuOpen] = useState(false);
// As the author's: a slower pick that fails after a later one landed doesn't roll it back.
@@ -2890,6 +2929,8 @@ export function DraftEditor({
isNew={draft.method === 'create'}
sourceUrl={draft.sourceUrl}
onPick={(type) => void pickPageType(type)}
+ open={typeMenuOpen}
+ onOpenChange={setTypeMenuOpen}
/>
{authorsRead && (
<AuthorMenu
@@ -3197,6 +3238,7 @@ export function DraftEditor({
onShowPlaceholder={showFirstPlaceholder}
onPickAuthor={() => setAuthorMenuOpen(true)}
onPickReviewer={() => setReviewerMenuOpen(true)}
+ onChangeType={() => setTypeMenuOpen(true)}
handOff={handOffCard}
yourInput={inputsRead.status === 'off' ? null : inputsRead}
onAddInput={addInput}
@@ -3253,8 +3295,14 @@ export function DraftEditor({
quality.trust?.score != null && quality.trust.score < TRUST_GATE
? quality.trust.score
: null,
- noAuthor: quality.eeat !== null && !quality.author && !authorConfirmed.real,
- noDisclosure: aiChecks?.disclosure?.found === false,
+ // A page type that goes out under the brand (CE-052) wants no author.
+ noAuthor:
+ quality.eeat !== null &&
+ !quality.author &&
+ !authorConfirmed.real &&
+ !checksOff(profile).has('byline'),
+ noDisclosure:
+ aiChecks?.disclosure?.found === false && !checksOff(profile).has('disclosure'),
article: isArticlePage(pageType),
onReview: () => {
setExportOpen(null);
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_page-type-menu.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_page-type-menu.tsx
index 81300563f..d65ea86c0 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_page-type-menu.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_page-type-menu.tsx
@@ -39,6 +39,8 @@ export function PageTypeMenu({
onPickSite,
sitePending = false,
siteGuessed = false,
+ open,
+ onOpenChange,
}: {
brandId: string;
siteType: SiteType;
@@ -55,6 +57,9 @@ export function PageTypeMenu({
sitePending?: boolean;
/** The brand has no site type picked yet: the one shown is guessed, as Brand settings says. */
siteGuessed?: boolean;
+ /** Opened from elsewhere too: Quality's Change (CE-052). */
+ open?: boolean;
+ onOpenChange?: (open: boolean) => void;
}) {
const t = useTranslations('contentEditor.editor');
const tTypes = useTranslations('contentEditor.pageTypes');
@@ -65,7 +70,7 @@ export function PageTypeMenu({
const label = current ? tTypes(current) : t('pageType.none');
return (
- <DropdownMenu>
+ <DropdownMenu open={open} onOpenChange={(next) => onOpenChange?.(next)}>
<DropdownMenuTrigger
aria-label={t('pageType.change', { type: label })}
title={detected ? t('pageType.detectedHint') : (sourceUrl ?? undefined)}
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 76b3ed213..2c2ccc307 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
@@ -96,6 +96,7 @@ const onAddSource = vi.fn();
const onConfirmImages = vi.fn();
const onAddImage = vi.fn();
const onPickReviewer = vi.fn();
+const onChangeType = vi.fn();
const onConfirmAuthor = vi.fn();
async function render(quality: QualityRead | Readability | null, handOff: HandOff | null = null) {
@@ -114,6 +115,7 @@ async function render(quality: QualityRead | Readability | null, handOff: HandOf
onConfirmImages={onConfirmImages}
onAddImage={onAddImage}
onPickReviewer={onPickReviewer}
+ onChangeType={onChangeType}
handOff={handOff}
onConfirmAuthor={onConfirmAuthor}
/>
@@ -134,6 +136,32 @@ beforeEach(() => {
afterEach(() => act(() => root.unmount()));
describe('QualityTab', () => {
+ it('says which page type the checks and weights follow, and Change opens its menu (CE-052)', async () => {
+ await render({
+ ...read(result),
+ weightsFor: { type: 'product_page', detected: true, profile: 'product' },
+ });
+ const line = [...container.querySelectorAll('p')].find((p) =>
+ p.textContent?.startsWith('Checks and weights for'),
+ )!;
+ expect(line.textContent).toBe(
+ "Checks and weights for Product page (detected): no author (your brand's), your own product photos, proof for claims, prices that match, short plain copy. Change",
+ );
+ await act(async () => line.querySelector('button')!.click());
+ expect(onChangeType).toHaveBeenCalled();
+ // No page type yet: an article's.
+ await render({
+ ...read(result),
+ weightsFor: { type: null, detected: true, profile: 'article' },
+ });
+ expect(container.textContent).toContain(
+ 'Checks and weights for an article (no page type yet): an author with experience',
+ );
+ // Before Phase 3: no line.
+ await render(read(result));
+ expect(container.textContent).not.toContain('Checks and weights for');
+ });
+
it('shows the three scores with their bands, labelled an Ansvisor estimate', async () => {
await render(result);
const scores = container.querySelector('[aria-label="Quality scores"]')!;
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 26ef853dd..46153edb3 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
@@ -8,7 +8,9 @@ import { Button, buttonVariants } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
import { normalizeDomain } from '@/lib/citations/classify';
import type { ContentAuthor } from '@/lib/content/authors';
+import { isPageType } from '@/lib/content/drafts';
import { BAND_CLASSES, qualityBand } from '@/lib/content/quality';
+import type { QualityProfile } from '@/lib/content/quality-profiles';
import {
authorProfile,
FRESH_MONTHS,
@@ -33,6 +35,11 @@ import { MANAGE_AUTHORS_PATH } from './_author-menu';
/** What Quality reads from the draft and its author, for the segment and the header. */
export interface QualityRead {
+ /**
+ * Phase 3 (CE-052): the page type the checks and weights follow, whether
+ * it was detected (not picked), and its profile; left out before.
+ */
+ weightsFor?: { type: string | null; detected: boolean; profile: QualityProfile } | null;
/** The page's Readability as written, or null before it is read. */
readability: Readability | null;
/** E-E-A-T from the author, or null before the authors are read. */
@@ -139,8 +146,11 @@ export function QualityTab({
onPickReviewer,
handOff = null,
onConfirmAuthor,
+ onChangeType,
}: {
quality: QualityRead;
+ /** Opens the header's page type menu: the checks and weights follow the type (CE-052). */
+ onChangeType?: () => void;
/** Scrolls the draft to a passage and marks it. */
onShow: (text: string) => void;
/** Selects the page's first placeholder, to type over. */
@@ -168,8 +178,9 @@ export function QualityTab({
}) {
const t = useTranslations('contentEditor.editor.quality');
const tSite = useTranslations('audit.siteTrust.checks');
+ const tTypes = useTranslations('contentEditor.pageTypes');
const format = useFormatter();
- const { readability, eeat, trust, siteTrust } = quality;
+ const { readability, eeat, trust, siteTrust, weightsFor } = quality;
const siteMissing = siteTrust ? siteTrustMissing(siteTrust) : [];
const scores: { name: ScoreName; score: number | null; empty: string }[] = [
{ name: 'eeat', score: eeat?.score ?? null, empty: t('notScored') },
@@ -209,6 +220,28 @@ export function QualityTab({
))}
</div>
<p className="text-xs text-muted-foreground">{t('estimate')}</p>
+ {weightsFor && (
+ <p className="text-xs text-muted-foreground">
+ {t('weightsFor.line', {
+ type: isPageType(weightsFor.type) ? tTypes(weightsFor.type) : t('weightsFor.noType'),
+ detected: weightsFor.detected && isPageType(weightsFor.type) ? 'yes' : 'no',
+ })}{' '}
+ {t(`weightsFor.${weightsFor.profile}`)}
+ {onChangeType && (
+ <>
+ {' '}
+ <button
+ type="button"
+ onClick={onChangeType}
+ aria-label={t('weightsFor.changeLabel')}
+ className="font-medium text-foreground underline-offset-2 hover:underline"
+ >
+ {t('weightsFor.change')}
+ </button>
+ </>
+ )}
+ </p>
+ )}
{readability?.score === null && (
<p className="rounded-xl border border-dashed px-3 py-2.5 text-xs text-muted-foreground">
{t(readability?.unscored === 'language' ? 'notThisLanguage' : 'tooShort')}
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_side-panel.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_side-panel.tsx
index f24393fc7..cadfb73c6 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_side-panel.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_side-panel.tsx
@@ -139,6 +139,7 @@ export function EditorSidePanel({
onConfirmImages,
onAddImage,
onPickReviewer,
+ onChangeType,
handOff = null,
}: {
draft: ContentDraft;
@@ -208,6 +209,8 @@ export function EditorSidePanel({
onAddImage?: () => void;
/** Quality's Pick reviewer: the header's reviewer menu (CE-049). */
onPickReviewer?: () => void;
+ /** Quality's Change: the header's page type menu (CE-052). */
+ onChangeType?: () => void;
/** Hand it off to Content Agent, Quality's (CE-051). */
handOff?: HandOff | null;
}) {
@@ -462,6 +465,7 @@ export function EditorSidePanel({
onConfirmImages={onConfirmImages}
onAddImage={onAddImage}
onPickReviewer={onPickReviewer}
+ onChangeType={onChangeType}
handOff={handOff}
/>
</div>
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 63a01edc0..47c7b9aea 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
@@ -2532,6 +2532,47 @@ describe('the side panel', () => {
vi.useRealTimers();
});
+ it('weighs the checks by the page type in phase 3, and follows a type changed from Quality (CE-052)', async () => {
+ process.env.NEXT_PUBLIC_CONTENT_QUALITY_PHASE = '3';
+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
+ getContentAuthors.mockResolvedValue({
+ authors: [],
+ brands: [{ id: 'b1', name: 'Acme' }],
+ me: { id: 'u1', role: 'admin' },
+ });
+ // A feature page goes out under the brand: no author asked for.
+ getContentDraft.mockResolvedValue(readable);
+ window.innerWidth = 1440;
+ await renderPage();
+ await act(async () => void (await vi.advanceTimersByTimeAsync(3_000)));
+ const chip = [...container.querySelectorAll<HTMLButtonElement>('header button')].find((b) =>
+ b.textContent?.startsWith('Quality'),
+ )!;
+ await act(async () => chip.click());
+ const line = () =>
+ [...panel()!.querySelectorAll('p')].find((p) =>
+ p.textContent?.startsWith('Checks and weights for'),
+ )!;
+ expect(line().textContent).toContain(
+ 'Checks and weights for Feature page: your own screenshots',
+ );
+ const todos = () =>
+ [...panel()!.querySelectorAll('[aria-label="Your to-dos"] li')].map(
+ (li) => li.textContent?.split(' · ')[0],
+ );
+ expect(todos()).not.toContain('Add an author for the page');
+
+ // Change opens the header's menu; a blog post asks for its author.
+ await act(async () => line().querySelector('button')!.click());
+ const blog = [...document.querySelectorAll<HTMLElement>('[role="menuitemradio"]')].find(
+ (item) => item.textContent?.startsWith('Blog post'),
+ )!;
+ await act(async () => blog.click());
+ expect(setContentDraftPageType).toHaveBeenCalledWith('d1', 'blog_post');
+ expect(line().textContent).toContain('Checks and weights for Blog post: an author');
+ expect(todos()).toContain('Add an author for the page');
+ });
+
it('shows nothing of Quality until its first phase is live', async () => {
getContentDraft.mockResolvedValue(readable);
window.innerWidth = 1440;
diff --git a/web/src/lib/content/quality-checks.test.ts b/web/src/lib/content/quality-checks.test.ts
index 578278998..2fdcd21b1 100644
--- a/web/src/lib/content/quality-checks.test.ts
+++ b/web/src/lib/content/quality-checks.test.ts
@@ -162,6 +162,9 @@ describe('trust (Phase 1: figures and links)', () => {
expect(run(linkOnly, working).score).toBeNull();
expect(trustGain(run(linkOnly, dead), ['noBrokenLinks'])).toBe(8);
expect(trustGain(run(linkOnly, working), ['noBrokenLinks'])).toBe(0);
+ // Out of the page type's Phase 1 points when weighed for it (CE-052).
+ expect(trustGain({ ...run(linkOnly, dead), phase1Points: 75 }, ['noBrokenLinks'])).toBe(4);
+ expect(trustGain({ ...run(linkOnly, dead), phase1Points: 0 }, ['noBrokenLinks'])).toBe(0);
// With a figure the links count among Trust's live checks: 30 + 0 of 33.
const withFigure = run(
diff --git a/web/src/lib/content/quality-checks.ts b/web/src/lib/content/quality-checks.ts
index 364458095..4c337d5de 100644
--- a/web/src/lib/content/quality-checks.ts
+++ b/web/src/lib/content/quality-checks.ts
@@ -28,7 +28,11 @@ export interface Score<Id extends string = string> {
checks: ScoreCheck<Id>[];
}
-/** E-E-A-T's checks and points (blog defaults); Phase 1 reads the author's. */
+/**
+ * E-E-A-T's checks and points (blog defaults); Phase 1 reads the author's.
+ * The brand's own information (its site's trust, CE-043) counts only on
+ * the page types that weigh it (a category page, quality-profiles.ts).
+ */
export const EEAT_WEIGHTS = {
experience: 20,
originalData: 15,
@@ -38,7 +42,10 @@ export const EEAT_WEIGHTS = {
whoHowWhy: 10,
dates: 10,
authorSchema: 10,
+ brandInfo: 0,
} as const;
+/** The brand info check's points before a page type weighs it (weighed keeps its share). */
+const BRAND_INFO_POINTS = 10;
export type EeatCheckId = keyof typeof EEAT_WEIGHTS;
/**
@@ -121,16 +128,30 @@ export function sentenceGain(
/**
* A Trust suggestion's gain. While Trust isn't scored (no figure and no
* dated source yet), the checks' missing points count out of the Phase 1
- * points, so a broken link still says what fixing it is worth.
+ * points (the page type's, CE-052, when weighed for it), so a broken link
+ * still says what fixing it is worth.
*/
-export function trustGain(result: Score<TrustCheckId>, ids: TrustCheckId[]): number {
+export function trustGain(
+ result: Score<TrustCheckId> & { phase1Points?: number },
+ ids: TrustCheckId[],
+): number {
if (result.score !== null) return scoreGain(result, ids);
- const missing = result.checks
- .filter((c) => ids.includes(c.id))
- .reduce((sum, c) => sum + c.max - c.points, 0);
- return Math.round((missing / TRUST_PHASE1_POINTS) * 100);
+ const named = result.checks.filter((c) => ids.includes(c.id));
+ const missing = named.reduce((sum, c) => sum + c.max - c.points, 0);
+ // A check outside Phase 1's (brand facts) counts out of its own points too.
+ const out =
+ (result.phase1Points ?? TRUST_PHASE1_POINTS) +
+ named.filter((c) => !PHASE1_CHECKS.has(c.id)).reduce((sum, c) => sum + c.max, 0);
+ return out > 0 ? Math.round((missing / out) * 100) : 0;
}
+/** Trust's Phase 1 checks: sourced figures, fresh sources, working links. */
+const PHASE1_CHECKS: ReadonlySet<TrustCheckId> = new Set([
+ 'claimsSourced',
+ 'freshSources',
+ 'noBrokenLinks',
+]);
+
/** What an author's profile has: a short bio, and profile links (Person schema's sameAs). */
export function authorProfile(author: ContentAuthor | null): { bio: boolean; links: boolean } {
return { bio: !!author?.bio?.trim(), links: (author?.sameAs.length ?? 0) > 0 };
@@ -149,8 +170,14 @@ export function eeat({
visual = null,
how = null,
confirmed = null,
+ siteTrust = null,
}: {
author: ContentAuthor | null;
+ /**
+ * The site's trust (its five checks in Site Audit, CE-043): the brand's own
+ * information, which only a page type that weighs it counts (CE-052).
+ */
+ siteTrust?: { score: number } | null;
/**
* Phase 2 (CE-050): whether the page says how it was made (tested,
* picked, researched, by whom), as the page read finds it; null where it
@@ -225,6 +252,15 @@ export function eeat({
: 0,
max: EEAT_WEIGHTS.authorBio,
},
+ ...(siteTrust
+ ? [
+ {
+ id: 'brandInfo' as const,
+ points: (BRAND_INFO_POINTS * siteTrust.score) / 5,
+ max: BRAND_INFO_POINTS,
+ },
+ ]
+ : []),
]);
}
diff --git a/web/src/lib/content/quality-profiles.test.ts b/web/src/lib/content/quality-profiles.test.ts
new file mode 100644
index 000000000..34c97f9f6
--- /dev/null
+++ b/web/src/lib/content/quality-profiles.test.ts
@@ -0,0 +1,195 @@
+import { describe, expect, it } from 'vitest';
+import { PAGE_TYPES } from './drafts';
+import { EEAT_WEIGHTS, TRUST_WEIGHTS, eeat, trust, trustBlocks } from './quality-checks';
+import {
+ PROFILE_WEIGHTS,
+ QUALITY_PROFILES,
+ checksOff,
+ profileFor,
+ weighed,
+ waitsForSiteTrust,
+ weighedTrust,
+} from './quality-profiles';
+import { READABILITY_WEIGHTS, readability } from './readability';
+
+/**
+ * Page types (Quality spec §11, CE-052): what the three scores count, and
+ * how much, follows the page's type from Phase 3 on.
+ */
+
+describe('profileFor', () => {
+ it('reads each page type as its profile in Phase 3, an article for the rest', () => {
+ expect(profileFor('product_page', 3)).toBe('product');
+ expect(profileFor('category_page', 3)).toBe('category');
+ expect(profileFor('collection_page', 3)).toBe('category');
+ expect(profileFor('feature_page', 3)).toBe('feature');
+ expect(profileFor('pricing', 3)).toBe('feature');
+ expect(profileFor('comparison', 3)).toBe('comparison');
+ expect(profileFor('best_of', 3)).toBe('comparison');
+ expect(profileFor('blog_post', 3)).toBe('article');
+ expect(profileFor('destination_page', 3)).toBe('article');
+ expect(profileFor(null, 3)).toBe('article');
+ for (const type of PAGE_TYPES) expect(QUALITY_PROFILES).toContain(profileFor(type, 3));
+ });
+
+ it('keeps every page an article before Phase 3', () => {
+ expect(profileFor('product_page', 2)).toBe('article');
+ expect(profileFor('comparison', 0)).toBe('article');
+ });
+});
+
+describe('PROFILE_WEIGHTS', () => {
+ it('gives each score 100 points in every profile, the article the blog defaults', () => {
+ const sum = (weights: Record<string, number>) =>
+ Object.values(weights).reduce((a, b) => a + b, 0);
+ for (const profile of QUALITY_PROFILES) {
+ const w = PROFILE_WEIGHTS[profile];
+ expect([sum(w.eeat), sum(w.trust), sum(w.readability)]).toEqual([100, 100, 100]);
+ }
+ expect(PROFILE_WEIGHTS.article.eeat).toEqual(EEAT_WEIGHTS);
+ expect(PROFILE_WEIGHTS.article.trust).toEqual(TRUST_WEIGHTS);
+ expect(PROFILE_WEIGHTS.article.readability).toEqual(READABILITY_WEIGHTS);
+ });
+
+ it('asks a product page for no author, and a comparison for balance and a disclosure', () => {
+ expect(checksOff('product')).toContain('byline');
+ expect(checksOff('product')).toContain('authorBio');
+ // An article counts every check but the brand's own information.
+ expect([...checksOff('article')]).toEqual(['brandInfo']);
+ expect(PROFILE_WEIGHTS.comparison.trust.balanced).toBeGreaterThan(
+ PROFILE_WEIGHTS.article.trust.balanced,
+ );
+ expect(checksOff('comparison')).not.toContain('disclosure');
+ });
+
+ it('waits for the site’s trust where E-E-A-T weighs the brand’s own information (#1491 review)', () => {
+ expect(waitsForSiteTrust('category')).toBe(true);
+ expect(QUALITY_PROFILES.filter(waitsForSiteTrust)).toEqual(['category']);
+ });
+});
+
+describe('weighed', () => {
+ const author = {
+ id: 'a1',
+ name: 'Ada',
+ title: null,
+ bio: 'Writes.',
+ photoUrl: null,
+ sameAs: [],
+ userId: null,
+ createdBy: null,
+ defaultFor: [],
+ pages: null,
+ };
+
+ it('keeps each check’s share of its points, out of the profile’s weight', () => {
+ // Byline 15/15, bio 5/10 (no links): 80 as an article.
+ const read = eeat({ author, used: { experience: false, data: true } });
+ expect(weighed(read, PROFILE_WEIGHTS.article.eeat).score).toBe(read.score);
+ // A product page: no author checks; data 20 of experience 20 + data 20.
+ const product = weighed(read, PROFILE_WEIGHTS.product.eeat);
+ expect(product.checks.map((c) => c.id)).toEqual(['experience', 'originalData']);
+ expect(product.score).toBe(50);
+ });
+
+ it('leaves a score not given as it was, and none with every check off', () => {
+ expect(weighed({ score: null, checks: [] }, PROFILE_WEIGHTS.product.eeat).score).toBeNull();
+ const authorOnly = eeat({ author });
+ expect(weighed(authorOnly, PROFILE_WEIGHTS.product.eeat)).toEqual({ score: null, checks: [] });
+ });
+
+ it('keeps what else a score carries (Readability’s words)', () => {
+ const html = `<h1>Pipeline</h1><p>${'Teams count each deal once a week. '.repeat(12)}</p>`;
+ const read = readability(html, 'en');
+ expect(weighed(read, PROFILE_WEIGHTS.product.readability)).toMatchObject({
+ words: read.words,
+ });
+ });
+
+ it('weighs a category page’s E-E-A-T with the brand’s own information, not all or nothing', () => {
+ const category = (own: number, site: number) =>
+ weighed(
+ eeat({
+ author: null,
+ visual: { images: 2, own, openSpots: 0 },
+ siteTrust: { score: site },
+ }),
+ PROFILE_WEIGHTS.category.eeat,
+ ).score;
+ // Stock images only, the site's trust in full: 40 of 100.
+ expect(category(0, 5)).toBe(40);
+ expect(category(1, 5)).toBe(100);
+ // An article leaves the brand's information out.
+ expect(
+ weighed(eeat({ author, siteTrust: { score: 0 } }), PROFILE_WEIGHTS.article.eeat).checks.map(
+ (c) => c.id,
+ ),
+ ).toEqual(['byline', 'authorBio']);
+ });
+});
+
+describe('weighedTrust', () => {
+ const now = Date.parse('2026-10-25');
+ const read = (html: string) =>
+ trust({
+ blocks: trustBlocks(html),
+ links: new Map([
+ [
+ 'https://example.org/report',
+ {
+ href: 'https://example.org/report',
+ status: 'ok',
+ httpStatus: 200,
+ date: '2019-01-01T00:00:00.000Z',
+ },
+ ],
+ ]),
+ brandDomains: ['acme.com'],
+ siteTrust: { score: 5 },
+ now,
+ });
+
+ it('isn’t scored by links and the site alone on a type that leaves freshness out', () => {
+ const dated = read('<p>See <a href="https://example.org/report">the report</a>.</p>');
+ // An article reads its stale source: scored.
+ expect(weighedTrust(dated, PROFILE_WEIGHTS.article.trust).score).not.toBeNull();
+ // A product page doesn't weigh freshness: a working link and the site aren't Trust.
+ const product = weighedTrust(dated, PROFILE_WEIGHTS.product.trust);
+ expect(product.score).toBeNull();
+ expect(product.phase1Points).toBe(40);
+ // A figure brings it in.
+ const figure = read(
+ '<p>It cut costs by 40% (<a href="https://example.org/report">the report</a>).</p>',
+ );
+ expect(weighedTrust(figure, PROFILE_WEIGHTS.product.trust).score).not.toBeNull();
+ });
+
+ it('is scored by a compared price where brand facts weigh as much as sourced claims (#1491 review)', () => {
+ // One wrong price, no claim, the site's trust in full.
+ const priced = trust({
+ blocks: trustBlocks('<p>The Ridge 28 costs $59.</p>'),
+ links: new Map(),
+ brandDomains: ['acme.com'],
+ siteTrust: { score: 5 },
+ brandFacts: {
+ compared: 1,
+ mismatches: [
+ {
+ kind: 'price',
+ page: '$59',
+ fact: '$49',
+ source: 'pricing',
+ sentence: 'The Ridge 28 costs $59.',
+ },
+ ],
+ },
+ now,
+ });
+ expect(priced.score).toBeNull();
+ // Brand facts 0 of 30, site trust 20 of 20: 40.
+ expect(weighedTrust(priced, PROFILE_WEIGHTS.product.trust).score).toBe(40);
+ expect(weighedTrust(priced, PROFILE_WEIGHTS.category.trust).score).not.toBeNull();
+ // An article weighs them 10 to its claims' 30: a price alone isn't its Trust.
+ expect(weighedTrust(priced, PROFILE_WEIGHTS.article.trust).score).toBeNull();
+ });
+});
diff --git a/web/src/lib/content/quality-profiles.ts b/web/src/lib/content/quality-profiles.ts
new file mode 100644
index 000000000..423243f8e
--- /dev/null
+++ b/web/src/lib/content/quality-profiles.ts
@@ -0,0 +1,285 @@
+import { qualityPhase } from './quality';
+import {
+ EEAT_WEIGHTS,
+ TRUST_WEIGHTS,
+ type EeatCheckId,
+ type Score,
+ type TrustCheckId,
+ type TrustRead,
+} from './quality-checks';
+import { READABILITY_WEIGHTS, type ReadabilityCheckId } from './readability';
+
+/**
+ * Page types (Content Editor Quality spec §11, Phase 3, CE-052): the three
+ * scores keep their names, but what each counts, and how much, follows the
+ * page's type. A product page has no author (the brand's byline) and wants
+ * real photos and proof; a category page short copy and real images; a
+ * feature page screenshots and sourced metrics; a comparison balance and a
+ * disclosure. Every other type reads as an article (a blog post or a guide).
+ *
+ * A weight of 0 leaves the check out, and the score is rescaled over the
+ * rest, as for a check not live yet. Ansvisor estimates, until calibrated
+ * with citation data (CE-055).
+ */
+
+export const QUALITY_PROFILES = [
+ 'article',
+ 'product',
+ 'category',
+ 'feature',
+ 'comparison',
+] as const;
+export type QualityProfile = (typeof QUALITY_PROFILES)[number];
+
+const BY_TYPE: Readonly<Record<string, QualityProfile>> = {
+ product_page: 'product',
+ category_page: 'category',
+ collection_page: 'category',
+ feature_page: 'feature',
+ solution_page: 'feature',
+ integration: 'feature',
+ pricing: 'feature',
+ comparison: 'comparison',
+ alternatives: 'comparison',
+ best_of: 'comparison',
+};
+
+/** The page type's profile: an article for any other type, none, or before Phase 3. */
+export function profileFor(
+ pageType: string | null | undefined,
+ phase: number = qualityPhase(),
+): QualityProfile {
+ return phase >= 3 && pageType ? (BY_TYPE[pageType] ?? 'article') : 'article';
+}
+
+export interface ProfileWeights {
+ eeat: Record<EeatCheckId, number>;
+ trust: Record<TrustCheckId, number>;
+ readability: Record<ReadabilityCheckId, number>;
+}
+
+/**
+ * Each profile's checks and points. The article's are the spec's blog
+ * defaults (§2); the others follow §11's table. Checks a type still lacks
+ * (reviews, a product feed, a customer case, a check date: Phase 3's later
+ * parts) join with their own points, rescaling the rest.
+ */
+export const PROFILE_WEIGHTS: Readonly<Record<QualityProfile, ProfileWeights>> = {
+ article: {
+ eeat: { ...EEAT_WEIGHTS },
+ trust: { ...TRUST_WEIGHTS },
+ readability: { ...READABILITY_WEIGHTS },
+ },
+ // No author (the brand's byline); real product photos; proof for its
+ // claims and prices that match; short, plain copy.
+ product: {
+ eeat: {
+ experience: 20,
+ originalData: 20,
+ byline: 0,
+ authorBio: 0,
+ visualProof: 60,
+ whoHowWhy: 0,
+ dates: 0,
+ authorSchema: 0,
+ brandInfo: 0,
+ },
+ trust: {
+ claimsSourced: 30,
+ primarySources: 5,
+ noWeakSources: 5,
+ brandFacts: 30,
+ expertQuote: 0,
+ freshSources: 0,
+ balanced: 0,
+ disclosure: 0,
+ noBrokenLinks: 10,
+ siteTrust: 20,
+ },
+ readability: {
+ avgSentence: 20,
+ longSentences: 25,
+ readingLevel: 25,
+ answerFirst: 0,
+ shortParagraphs: 20,
+ headingSpacing: 0,
+ passiveJargon: 10,
+ },
+ },
+ // Low E-E-A-T weight: real product images and the brand's own
+ // information (its site's trust); prices and claims that match the
+ // brand's; a short intro.
+ category: {
+ eeat: {
+ experience: 0,
+ originalData: 0,
+ byline: 0,
+ authorBio: 0,
+ visualProof: 60,
+ whoHowWhy: 0,
+ dates: 0,
+ authorSchema: 0,
+ brandInfo: 40,
+ },
+ trust: {
+ claimsSourced: 25,
+ primarySources: 0,
+ noWeakSources: 5,
+ brandFacts: 30,
+ expertQuote: 0,
+ freshSources: 0,
+ balanced: 0,
+ disclosure: 0,
+ noBrokenLinks: 15,
+ siteTrust: 25,
+ },
+ readability: {
+ avgSentence: 25,
+ longSentences: 25,
+ readingLevel: 25,
+ answerFirst: 0,
+ shortParagraphs: 25,
+ headingSpacing: 0,
+ passiveJargon: 0,
+ },
+ },
+ // Product screenshots weigh most, then the person's data and use;
+ // sourced metrics and a price that matches; scannable sections.
+ feature: {
+ eeat: {
+ experience: 25,
+ originalData: 25,
+ byline: 0,
+ authorBio: 0,
+ visualProof: 50,
+ whoHowWhy: 0,
+ dates: 0,
+ authorSchema: 0,
+ brandInfo: 0,
+ },
+ trust: {
+ claimsSourced: 35,
+ primarySources: 10,
+ noWeakSources: 5,
+ brandFacts: 20,
+ expertQuote: 10,
+ freshSources: 5,
+ balanced: 0,
+ disclosure: 0,
+ noBrokenLinks: 5,
+ siteTrust: 10,
+ },
+ readability: {
+ avgSentence: 20,
+ longSentences: 15,
+ readingLevel: 15,
+ answerFirst: 10,
+ shortParagraphs: 20,
+ headingSpacing: 15,
+ passiveJargon: 5,
+ },
+ },
+ // An author, saying how the picks were made; balance and a disclosure,
+ // each rival's facts from its own pages; the summary first.
+ comparison: {
+ eeat: {
+ experience: 20,
+ originalData: 10,
+ byline: 15,
+ authorBio: 10,
+ visualProof: 10,
+ whoHowWhy: 20,
+ dates: 10,
+ authorSchema: 5,
+ brandInfo: 0,
+ },
+ trust: {
+ claimsSourced: 25,
+ primarySources: 15,
+ noWeakSources: 5,
+ brandFacts: 5,
+ expertQuote: 0,
+ freshSources: 5,
+ balanced: 20,
+ disclosure: 15,
+ noBrokenLinks: 5,
+ siteTrust: 5,
+ },
+ readability: {
+ avgSentence: 20,
+ longSentences: 15,
+ readingLevel: 15,
+ answerFirst: 25,
+ shortParagraphs: 10,
+ headingSpacing: 10,
+ passiveJargon: 5,
+ },
+ },
+};
+
+/** The checks a profile leaves out (weight 0): no to-do or suggestion asks for them. */
+export function checksOff(profile: QualityProfile): ReadonlySet<string> {
+ const w = PROFILE_WEIGHTS[profile];
+ return new Set(
+ [...Object.entries(w.eeat), ...Object.entries(w.trust), ...Object.entries(w.readability)]
+ .filter(([, points]) => points === 0)
+ .map(([id]) => id),
+ );
+}
+
+/**
+ * Whether a profile's E-E-A-T waits for the site's trust: it weighs the
+ * brand's own information (a category page's 40), and a score from the
+ * images alone would jump once the site is read.
+ */
+export const waitsForSiteTrust = (profile: QualityProfile) =>
+ PROFILE_WEIGHTS[profile].eeat.brandInfo > 0;
+
+/**
+ * A score's checks weighed for a profile: each keeps its share of its
+ * points (half of them stays half), out of the profile's weight; one
+ * weighing 0 is left out, and the score rescaled over the rest. A score
+ * that wasn't given (none of its checks live) stays not given.
+ */
+export function weighed<Id extends string, S extends Score<Id>>(
+ result: S,
+ weights: Readonly<Record<Id, number>>,
+): S {
+ const checks = result.checks.flatMap((c) => {
+ const max = weights[c.id] ?? c.max;
+ return max > 0 ? [{ ...c, points: c.max > 0 ? (c.points / c.max) * max : 0, max }] : [];
+ });
+ const total = checks.reduce((sum, c) => sum + c.max, 0);
+ const score =
+ result.score === null || total === 0
+ ? null
+ : Math.round((checks.reduce((sum, c) => sum + c.points, 0) / total) * 100);
+ return { ...result, checks, score };
+}
+
+/**
+ * Trust weighed for a profile, scored as trust() scores it: once a figure
+ * or fresh-sources check is left among the weighed ones, or two sources are
+ * placed; on a type that weighs brand facts as much as sourced claims, once
+ * a price is compared with them too. A type isn't scored by its links and
+ * site alone. Its unscored gains count out of the type's Phase 1 points.
+ */
+export function weighedTrust(
+ read: TrustRead,
+ weights: ProfileWeights['trust'],
+): TrustRead & { phase1Points: number } {
+ // Scored here, by the weighed checks: trust() leaves it unscored by its own.
+ const result = weighed({ ...read, score: read.score ?? 0 }, weights);
+ const scored =
+ result.checks.some((c) => c.id === 'claimsSourced' || c.id === 'freshSources') ||
+ read.classified >= 2 ||
+ // Where prices that match weigh as much as sourced claims (a product or a
+ // category page), a compared one is Trust's own: every price wrong isn't "Not scored".
+ (weights.brandFacts >= weights.claimsSourced &&
+ result.checks.some((c) => c.id === 'brandFacts'));
+ return {
+ ...result,
+ score: scored ? result.score : null,
+ phase1Points: weights.claimsSourced + weights.freshSources + weights.noBrokenLinks,
+ };
+}
diff --git a/web/src/lib/content/quality-todos.test.ts b/web/src/lib/content/quality-todos.test.ts
index 73669ecd5..1af371c90 100644
--- a/web/src/lib/content/quality-todos.test.ts
+++ b/web/src/lib/content/quality-todos.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import type { ContentAuthor } from './authors';
import type { PageProof } from './page-read';
import { eeat, trust, trustBlocks } from './quality-checks';
+import { PROFILE_WEIGHTS, checksOff, weighed } from './quality-profiles';
import { proofKey, qualityTodos } from './quality-todos';
/** Your to-dos (Quality spec §4, CE-040): only what the person can do, read from the checks. */
@@ -30,6 +31,24 @@ describe('qualityTodos', () => {
]);
});
+ it('asks for no author on a page type that goes out under the brand (CE-052)', () => {
+ const product = qualityTodos({
+ eeat: weighed(
+ eeat({ author: null, used: { experience: false, data: false } }),
+ PROFILE_WEIGHTS.product.eeat,
+ ),
+ author: null,
+ hasAuthors: true,
+ used: { experience: false, data: false, quote: false },
+ off: checksOff('product'),
+ });
+ // Experience and data are half its live E-E-A-T each.
+ expect(product.map((t) => [t.id, t.gain])).toEqual([
+ ['experience', 50],
+ ['originalData', 50],
+ ]);
+ });
+
it('asks to add an author when the workspace has none', () => {
expect(todos(null, false)[0]).toEqual({
id: 'byline',
diff --git a/web/src/lib/content/quality-todos.ts b/web/src/lib/content/quality-todos.ts
index 199d1e46e..c332dbcbf 100644
--- a/web/src/lib/content/quality-todos.ts
+++ b/web/src/lib/content/quality-todos.ts
@@ -102,6 +102,7 @@ export function qualityTodos({
visual = null,
reviewer = null,
confirmed = null,
+ off = NONE_OFF,
}: {
eeat: Score<EeatCheckId> | null;
author: ContentAuthor | null;
@@ -143,6 +144,11 @@ export function qualityTodos({
reviewer?: { topic: 'health' | 'finance' | 'legal'; picked: boolean } | null;
/** What the person confirmed of the author their site names (00271), or null where they can't. */
confirmed?: { real: boolean; profile: boolean } | null;
+ /**
+ * Phase 3 (CE-052): the checks the page's type leaves out (checksOff): no
+ * to-do asks for them (a product page has the brand's byline, no author).
+ */
+ off?: ReadonlySet<string>;
}): QualityTodo[] {
const fill: QualityTodo[] =
placeholders.count || placeholders.had
@@ -215,7 +221,8 @@ export function qualityTodos({
...(byConfirm ? { confirm: { what: 'real' as const, on: confirmed.real } } : {}),
};
const { bio, links } = authorProfile(author);
- return [
+ const wanted = (todo: QualityTodo) => !off.has(CHECK_OF[todo.id] ?? todo.id);
+ const todos: QualityTodo[] = [
...fill,
byline,
{
@@ -269,8 +276,13 @@ export function qualityTodos({
...review,
...facts,
];
+ return todos.filter(wanted);
}
+const NONE_OFF: ReadonlySet<string> = new Set();
+/** The check each to-do raises, where its id isn't the check's. */
+const CHECK_OF: Partial<Record<string, string>> = { authorProfile: 'authorBio' };
+
/** A text's 32-bit FNV-1a hash, in base 36: a short, stable name for it. */
function shortHash(text: string): string {
let hash = 0x811c9dc5;