From fb1c0c5f4c8be6248f15a84c368e23f51db92382 Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Tue, 29 Sep 2026 14:45:06 +0530 Subject: [PATCH 1/8] fix(website): leave loading status text out of markdown twins --- apps/website/src/lib/markdown-twin.test.ts | 2 ++ apps/website/src/lib/markdown-twin.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/website/src/lib/markdown-twin.test.ts b/apps/website/src/lib/markdown-twin.test.ts index d9269c196b5..429e3d7092c 100644 --- a/apps/website/src/lib/markdown-twin.test.ts +++ b/apps/website/src/lib/markdown-twin.test.ts @@ -29,6 +29,7 @@ const PAGE = ` icon +

Loading

Set up Comfy CLI

@@ -84,6 +85,7 @@ describe('htmlToTwin', () => { expect(page.body).not.toContain('icon') expect(page.body).not.toContain('Copy') expect(page.body).not.toContain('clip.mp4') + expect(page.body).not.toContain('Loading') }) it('makes links absolute, drops anchor links, and keeps emphasis', () => { diff --git a/apps/website/src/lib/markdown-twin.ts b/apps/website/src/lib/markdown-twin.ts index 466a5f2c86f..26773e73316 100644 --- a/apps/website/src/lib/markdown-twin.ts +++ b/apps/website/src/lib/markdown-twin.ts @@ -89,7 +89,8 @@ function tag(element: Element): string { function isDropped(element: Element): boolean { return ( DROPPED_TAGS.has(tag(element)) || - element.getAttribute('aria-hidden') === 'true' + element.getAttribute('aria-hidden') === 'true' || + element.getAttribute('role') === 'status' ) } From 054ac1612f8b35a670782b8e0d71127f18ebb198 Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Tue, 29 Sep 2026 14:48:36 +0530 Subject: [PATCH 2/8] feat(website): give a model page a markdown twin once it is indexable --- apps/website/src/config/indexing.ts | 8 ++- apps/website/src/config/model-page-launch.ts | 1 + apps/website/src/lib/markdown-twin.test.ts | 60 +++++++++++++++++++- apps/website/src/routes/models/[slug].astro | 3 +- 4 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 apps/website/src/config/model-page-launch.ts diff --git a/apps/website/src/config/indexing.ts b/apps/website/src/config/indexing.ts index 17e90c78cc8..74a3011d641 100644 --- a/apps/website/src/config/indexing.ts +++ b/apps/website/src/config/indexing.ts @@ -1,5 +1,7 @@ import { LOCALE_CODES, LOCALES } from './locales' +import { MODEL_PAGES_INDEXABLE } from './model-page-launch' import { models } from './models' +import { modelsUrlKind } from './models-url-registry' import { isLegacyWorkshopRoute, isWorkshopRoute } from './workshop-release' const PAYMENT_STATUSES = ['success', 'failed'] as const @@ -50,12 +52,16 @@ export function isNoindexPathname(pathname: string): boolean { return NOINDEX_PATHNAMES.has(normalizePathname(pathname)) } +export function isIndexableModelPage(pathname: string): boolean { + return MODEL_PAGES_INDEXABLE && modelsUrlKind(pathname) === 'model' +} + export function isExcludedFromSitemap(page: string): boolean { const pathname = normalizePathname(new URL(page).pathname) return ( isNoindexPathname(pathname) || isLegacyWorkshopRoute(pathname) || MODEL_REDIRECT_PATHNAMES.has(pathname) || - isWorkshopRoute(pathname) + (isWorkshopRoute(pathname) && !isIndexableModelPage(pathname)) ) } diff --git a/apps/website/src/config/model-page-launch.ts b/apps/website/src/config/model-page-launch.ts new file mode 100644 index 00000000000..f96059dba84 --- /dev/null +++ b/apps/website/src/config/model-page-launch.ts @@ -0,0 +1 @@ +export const MODEL_PAGES_INDEXABLE: boolean = false diff --git a/apps/website/src/lib/markdown-twin.test.ts b/apps/website/src/lib/markdown-twin.test.ts index 429e3d7092c..cbb26737c39 100644 --- a/apps/website/src/lib/markdown-twin.test.ts +++ b/apps/website/src/lib/markdown-twin.test.ts @@ -1,13 +1,20 @@ import { mkdtemp, readFile, mkdir, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { describe, expect, it } from 'vitest' +import { afterEach, describe, expect, it, vi } from 'vitest' +import { + routerModelSlugAliases, + workshopModels +} from '../config/workshop-browse-content' import { writeMarkdownTwins } from '../integrations/markdown-twins' import { writeSectionIndexes } from './section-index' import { htmlToTwin, renderTwin } from './markdown-twin' import { markdownTwinPath } from './markdown-twin-path' +const launch = vi.hoisted(() => ({ MODEL_PAGES_INDEXABLE: false })) +vi.mock(import('../config/model-page-launch'), () => launch) + const PAGE = ` @@ -258,4 +265,55 @@ describe('writeMarkdownTwins', () => { const index = await readFile(join(root, 'learning', 'llms.txt'), 'utf8') expect(index).toContain('[Learning](https://comfy.org/learning.md)') }) + + describe('model pages', () => { + const [modelSlug] = workshopModels.map(({ slug }) => slug) + const [[aliasSlug]] = routerModelSlugAliases + const modelPages = [ + `models/${modelSlug}/`, + `models/${aliasSlug}/`, + 'models/showcase/' + ] + + async function buildModelPages() { + const root = await mkdtemp(join(tmpdir(), 'twins-')) + for (const pathname of modelPages) { + await mkdir(join(root, pathname), { recursive: true }) + await writeFile( + join(root, pathname, 'index.html'), + `${pathname}

${pathname}

` + ) + } + return root + } + + afterEach(() => { + launch.MODEL_PAGES_INDEXABLE = false + }) + + it('writes no model twin until model pages are indexable', async () => { + const report = await writeMarkdownTwins( + await buildModelPages(), + modelPages + ) + + expect(report.written).toEqual([]) + }) + + it('twins only canonical model pages once they are indexable', async () => { + launch.MODEL_PAGES_INDEXABLE = true + const root = await buildModelPages() + + const report = await writeMarkdownTwins(root, modelPages) + + expect(report.written).toEqual([`/models/${modelSlug}.md`]) + expect(report.skipped).toEqual([ + `/models/${aliasSlug}.md`, + '/models/showcase.md' + ]) + expect( + await readFile(join(root, 'models', `${modelSlug}.md`), 'utf8') + ).toContain(`canonical: https://comfy.org/models/${modelSlug}/\n`) + }) + }) }) diff --git a/apps/website/src/routes/models/[slug].astro b/apps/website/src/routes/models/[slug].astro index c54fcaefeba..063c92223c4 100644 --- a/apps/website/src/routes/models/[slug].astro +++ b/apps/website/src/routes/models/[slug].astro @@ -3,6 +3,7 @@ import type { GetStaticPaths } from 'astro' import BaseLayout from '../../layouts/BaseLayout.astro' import ModelsPage from '../../components/workshop/ModelsPage.vue' import ModelsShowcase from '../../components/models/ModelsShowcase.astro' +import { isIndexableModelPage } from '../../config/indexing' import { workshopPagePaths } from '../../config/workshop-page-content' import { t } from '../../i18n/translations' import { prepareModelPage } from './model-page' @@ -24,7 +25,7 @@ const { model } = page name: model.name })} ogImage={model.thumbnailUrl} - noindex + noindex={!isIndexableModelPage(Astro.url.pathname)} > From aec94849585e0e0b7595e7c80638cf0a53fd342c Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Tue, 29 Sep 2026 14:57:42 +0530 Subject: [PATCH 3/8] fix(website): keep a page's own header in its markdown twin --- apps/website/src/lib/markdown-twin.test.ts | 4 +++- apps/website/src/lib/markdown-twin.ts | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/website/src/lib/markdown-twin.test.ts b/apps/website/src/lib/markdown-twin.test.ts index cbb26737c39..a4d23bc4db4 100644 --- a/apps/website/src/lib/markdown-twin.test.ts +++ b/apps/website/src/lib/markdown-twin.test.ts @@ -23,10 +23,11 @@ const PAGE = ` +
Comfy home
-

Drive ComfyUI from your terminal.
Or your agent's.

+

Drive ComfyUI from your terminal.
Or your agent's.

Generate from Comfy Cloud or your own GPU with comfy-cli.

@@ -87,6 +88,7 @@ describe('htmlToTwin', () => { "# Drive ComfyUI from your terminal. Or your agent's." ) expect(page.body).not.toContain('Comfy MCP') + expect(page.body).not.toContain('Comfy home') expect(page.body).not.toContain('Products') expect(page.body).not.toContain('window.track') expect(page.body).not.toContain('icon') diff --git a/apps/website/src/lib/markdown-twin.ts b/apps/website/src/lib/markdown-twin.ts index 26773e73316..4031d59ad4f 100644 --- a/apps/website/src/lib/markdown-twin.ts +++ b/apps/website/src/lib/markdown-twin.ts @@ -29,7 +29,6 @@ const DROPPED_TAGS = new Set([ 'FORM', 'NAV', 'FOOTER', - 'HEADER', 'DIALOG', 'SOURCE', 'TRACK' @@ -46,6 +45,7 @@ const BLOCK_TAGS = new Set([ 'DT', 'FIGCAPTION', 'FIGURE', + 'HEADER', 'MAIN', 'P', 'SECTION', @@ -86,9 +86,15 @@ function tag(element: Element): string { return element.tagName.toUpperCase() } +/** Only the site banner is chrome; a header inside main introduces the page. */ +function isBanner(element: Element): boolean { + return tag(element) === 'HEADER' && element.closest('main') === null +} + function isDropped(element: Element): boolean { return ( DROPPED_TAGS.has(tag(element)) || + isBanner(element) || element.getAttribute('aria-hidden') === 'true' || element.getAttribute('role') === 'status' ) From 1ef36e5feaa0c683d0c98b763221178f8160f27b Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Tue, 29 Sep 2026 18:32:08 +0530 Subject: [PATCH 4/8] fix(website): treat a header as the site banner only outside sectioning content --- apps/website/src/lib/markdown-twin.test.ts | 25 ++++++++++++++++++---- apps/website/src/lib/markdown-twin.ts | 7 ++++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/apps/website/src/lib/markdown-twin.test.ts b/apps/website/src/lib/markdown-twin.test.ts index a4d23bc4db4..531f1142564 100644 --- a/apps/website/src/lib/markdown-twin.test.ts +++ b/apps/website/src/lib/markdown-twin.test.ts @@ -128,6 +128,14 @@ describe('htmlToTwin', () => { expect(page.body).toContain('> Method, not magic.') }) + it('drops the site banner but keeps page headers when there is no main', () => { + const noMain = htmlToTwin( + '
Comfy home

Pack

Nodes.

', + 'https://comfy.org/x/' + ) + expect(noMain.body).toBe('# Pack\n\nNodes.') + }) + it('falls back to the route when the page has no canonical link', () => { const bare = htmlToTwin( '

x

', @@ -283,7 +291,7 @@ describe('writeMarkdownTwins', () => { await mkdir(join(root, pathname), { recursive: true }) await writeFile( join(root, pathname, 'index.html'), - `${pathname}

${pathname}

` + `${pathname}
Comfy home

Provider

${pathname}

Model summary.

Loading

` ) } return root @@ -313,9 +321,18 @@ describe('writeMarkdownTwins', () => { `/models/${aliasSlug}.md`, '/models/showcase.md' ]) - expect( - await readFile(join(root, 'models', `${modelSlug}.md`), 'utf8') - ).toContain(`canonical: https://comfy.org/models/${modelSlug}/\n`) + const twin = await readFile( + join(root, 'models', `${modelSlug}.md`), + 'utf8' + ) + expect(twin).toContain( + `canonical: https://comfy.org/models/${modelSlug}/\n` + ) + expect(twin).toContain( + `---\n\nProvider\n\n# models/${modelSlug}/\n\nModel summary.\n` + ) + expect(twin).not.toContain('Loading') + expect(twin).not.toContain('Comfy home') }) }) }) diff --git a/apps/website/src/lib/markdown-twin.ts b/apps/website/src/lib/markdown-twin.ts index 4031d59ad4f..0c2ebb45e01 100644 --- a/apps/website/src/lib/markdown-twin.ts +++ b/apps/website/src/lib/markdown-twin.ts @@ -86,9 +86,12 @@ function tag(element: Element): string { return element.tagName.toUpperCase() } -/** Only the site banner is chrome; a header inside main introduces the page. */ +/** A header is the site banner unless it sits in sectioning content (HTML-AAM). */ function isBanner(element: Element): boolean { - return tag(element) === 'HEADER' && element.closest('main') === null + return ( + tag(element) === 'HEADER' && + element.closest('main, article, aside, nav, section') === null + ) } function isDropped(element: Element): boolean { From d47506c5035e5e6b9a35a678a51e54f908b8b60d Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Wed, 30 Sep 2026 01:06:55 +0530 Subject: [PATCH 5/8] fix(website): write no markdown twin or twin link for a page with no content, and drop only the Workshop spinner --- .../components/workshop/WorkshopLoading.vue | 1 + .../src/integrations/markdown-twins.ts | 34 +++++-- apps/website/src/lib/markdown-twin.test.ts | 90 +++++++++++-------- apps/website/src/lib/markdown-twin.ts | 6 +- .../src/pages/workshop/models/[slug].astro | 5 -- 5 files changed, 84 insertions(+), 52 deletions(-) diff --git a/apps/website/src/components/workshop/WorkshopLoading.vue b/apps/website/src/components/workshop/WorkshopLoading.vue index 3eb7c60ae1c..8e845f9ef88 100644 --- a/apps/website/src/components/workshop/WorkshopLoading.vue +++ b/apps/website/src/components/workshop/WorkshopLoading.vue @@ -20,6 +20,7 @@ const { label, minh = true } = defineProps<{ ) " data-testid="workshop-loading" + data-twin-omit > { } } -async function readBuiltPage( +async function builtPagePath( root: string, pathname: string ): Promise { @@ -65,11 +65,29 @@ async function readBuiltPage( join(root, `${trimmed || 'index'}.html`) ] for (const candidate of candidates) { - if (await exists(candidate)) return readFile(candidate, 'utf8') + if (await exists(candidate)) return candidate } return undefined } +async function readBuiltPage( + root: string, + pathname: string +): Promise { + const path = await builtPagePath(root, pathname) + return path === undefined ? undefined : readFile(path, 'utf8') +} + +const TWIN_LINK = /]*>/ + +async function unlinkTwin(root: string, pathname: string): Promise { + const path = await builtPagePath(root, pathname) + if (path === undefined) return + const html = await readFile(path, 'utf8') + const unlinked = html.replace(TWIN_LINK, '') + if (unlinked !== html) await writeFile(path, unlinked, 'utf8') +} + async function readBuiltTwinSource( root: string, pathname: string @@ -88,8 +106,9 @@ async function readBuiltTwinSource( /** * Write a `.md` twin next to every built HTML page: `/cli/` → `/cli.md`, - * `/` → `/index.md`. Pages kept out of the sitemap get no twin, and a twin - * that already exists (hand-written by a page endpoint) is left alone. + * `/` → `/index.md`. Pages kept out of the sitemap get no twin, a page with no + * content loses its markdown link instead, and a twin that already exists + * (hand-written by a page endpoint) is left alone. */ export async function writeMarkdownTwins( root: string, @@ -125,6 +144,11 @@ export async function writeMarkdownTwins( const page = htmlToTwin(source.html, canonical, { canonical: source.alternate ? canonical : undefined }) + if (page.body === '') { + await unlinkTwin(root, pathname) + report.skipped.push(twinPath) + continue + } await mkdir(dirname(target), { recursive: true }) await writeFile(target, renderTwin(page), 'utf8') report.written.push(twinPath) diff --git a/apps/website/src/lib/markdown-twin.test.ts b/apps/website/src/lib/markdown-twin.test.ts index 22cc7068139..a0d816c8777 100644 --- a/apps/website/src/lib/markdown-twin.test.ts +++ b/apps/website/src/lib/markdown-twin.test.ts @@ -1,8 +1,11 @@ import { mkdtemp, readFile, mkdir, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { afterEach, describe, expect, it, vi } from 'vitest' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { h } from 'vue' +import { renderToString } from 'vue/server-renderer' +import WorkshopLoading from '../components/workshop/WorkshopLoading.vue' import { isExcludedFromSitemap } from '../config/indexing' import { routerModelSlugAliases, @@ -16,6 +19,10 @@ import { markdownTwinPath } from './markdown-twin-path' const launch = vi.hoisted(() => ({ MODEL_PAGES_INDEXABLE: false })) vi.mock(import('../config/model-page-launch'), () => launch) +const loadingSpinner = await renderToString( + h(WorkshopLoading, { label: 'Loading' }) +) + const PAGE = ` @@ -38,7 +45,8 @@ const PAGE = ` icon -

Loading

+ ${loadingSpinner} +

Saved to your library.

Set up Comfy CLI

@@ -95,7 +103,11 @@ describe('htmlToTwin', () => { expect(page.body).not.toContain('icon') expect(page.body).not.toContain('Copy') expect(page.body).not.toContain('clip.mp4') + }) + + it('drops the Workshop loading spinner but keeps other status copy', () => { expect(page.body).not.toContain('Loading') + expect(page.body).toContain('Saved to your library.') }) it('makes links absolute, drops anchor links, and keeps emphasis', () => { @@ -322,62 +334,62 @@ describe('writeMarkdownTwins', () => { }) describe('model pages', () => { - const [modelSlug] = workshopModels.map(({ slug }) => slug) - const [[aliasSlug]] = routerModelSlugAliases - const modelPages = [ - `models/${modelSlug}/`, - `models/${aliasSlug}/`, - 'models/showcase/' - ] + const [{ slug: modelSlug }] = workshopModels + const route = `models/${modelSlug}/` + const twinPath = `/models/${modelSlug}.md` - async function buildModelPages() { + async function buildModelPage(main: string) { const root = await mkdtemp(join(tmpdir(), 'twins-')) - for (const pathname of modelPages) { - await mkdir(join(root, pathname), { recursive: true }) - await writeFile( - join(root, pathname, 'index.html'), - `${pathname}
Comfy home

Provider

${pathname}

Model summary.

Loading

` - ) - } + await mkdir(join(root, route), { recursive: true }) + await writeFile( + join(root, route, 'index.html'), + `${modelSlug}
Comfy home
${main}
` + ) return root } + const readPage = (root: string) => + readFile(join(root, route, 'index.html'), 'utf8') + + beforeEach(() => { + launch.MODEL_PAGES_INDEXABLE = true + }) + afterEach(() => { launch.MODEL_PAGES_INDEXABLE = false }) - it('writes no model twin until model pages are indexable', async () => { - const report = await writeMarkdownTwins( - await buildModelPages(), - modelPages + it('writes no twin and drops the markdown link for a spinner-only page', async () => { + const root = await buildModelPage( + `${loadingSpinner}` ) + const report = await writeMarkdownTwins(root, [route]) + expect(report.written).toEqual([]) + expect(report.skipped).toEqual([twinPath]) + await expect(readFile(join(root, twinPath))).rejects.toThrow() + const html = await readPage(root) + expect(html).not.toContain('text/markdown') + expect(html).toContain('rel="canonical"') }) - it('twins only canonical model pages once they are indexable', async () => { - launch.MODEL_PAGES_INDEXABLE = true - const root = await buildModelPages() - - const report = await writeMarkdownTwins(root, modelPages) - - expect(report.written).toEqual([`/models/${modelSlug}.md`]) - expect(report.skipped).toEqual([ - `/models/${aliasSlug}.md`, - '/models/showcase.md' - ]) - const twin = await readFile( - join(root, 'models', `${modelSlug}.md`), - 'utf8' - ) - expect(twin).toContain( - `canonical: https://comfy.org/models/${modelSlug}/\n` + it('twins the server-rendered hero and drops the spinner (post-FE-2942 shape)', async () => { + const root = await buildModelPage( + `

Provider

Model name

Model summary.

${loadingSpinner}` ) + + const report = await writeMarkdownTwins(root, [route]) + + expect(report.written).toEqual([twinPath]) + const twin = await readFile(join(root, twinPath), 'utf8') + expect(twin).toContain(`canonical: https://comfy.org/${route}\n`) expect(twin).toContain( - `---\n\nProvider\n\n# models/${modelSlug}/\n\nModel summary.\n` + '---\n\nProvider\n\n# Model name\n\nModel summary.\n' ) expect(twin).not.toContain('Loading') expect(twin).not.toContain('Comfy home') + expect(await readPage(root)).toContain('text/markdown') }) }) }) diff --git a/apps/website/src/lib/markdown-twin.ts b/apps/website/src/lib/markdown-twin.ts index 0c2ebb45e01..9458cdbda27 100644 --- a/apps/website/src/lib/markdown-twin.ts +++ b/apps/website/src/lib/markdown-twin.ts @@ -86,11 +86,11 @@ function tag(element: Element): string { return element.tagName.toUpperCase() } -/** A header is the site banner unless it sits in sectioning content (HTML-AAM). */ +/** HTML-AAM: a header outside main, article, aside and section is the site banner. */ function isBanner(element: Element): boolean { return ( tag(element) === 'HEADER' && - element.closest('main, article, aside, nav, section') === null + element.closest('main, article, aside, section') === null ) } @@ -99,7 +99,7 @@ function isDropped(element: Element): boolean { DROPPED_TAGS.has(tag(element)) || isBanner(element) || element.getAttribute('aria-hidden') === 'true' || - element.getAttribute('role') === 'status' + element.hasAttribute('data-twin-omit') ) } diff --git a/apps/website/src/pages/workshop/models/[slug].astro b/apps/website/src/pages/workshop/models/[slug].astro index 82abb73437a..0efa2666786 100644 --- a/apps/website/src/pages/workshop/models/[slug].astro +++ b/apps/website/src/pages/workshop/models/[slug].astro @@ -47,11 +47,6 @@ const { model, related } = Astro.props - {/* - A div, not a header. `markdown-twin.ts` drops HEADER along with the - site chrome, so wrapping the hero in one leaves every model's llms.txt - entry with a title and nothing else. The h1 still carries the heading. - */}

{model.provider} From 20150a17a02e540caf29ac4514135eba4e1a1d5e Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Wed, 30 Sep 2026 01:58:34 +0530 Subject: [PATCH 6/8] fix(website): fail the build when a contentless page keeps its markdown link unlinkTwin now throws, naming the built file, when it finds no markdown alternate link to remove, and matches the link whatever its attribute order. --- .../src/integrations/markdown-twins.ts | 7 +++-- apps/website/src/lib/markdown-twin.test.ts | 29 +++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/apps/website/src/integrations/markdown-twins.ts b/apps/website/src/integrations/markdown-twins.ts index 207a554e16f..a587438735c 100644 --- a/apps/website/src/integrations/markdown-twins.ts +++ b/apps/website/src/integrations/markdown-twins.ts @@ -78,14 +78,17 @@ async function readBuiltPage( return path === undefined ? undefined : readFile(path, 'utf8') } -const TWIN_LINK = /]*>/ +const TWIN_LINK = /]*\btype="text\/markdown"[^>]*>/ async function unlinkTwin(root: string, pathname: string): Promise { const path = await builtPagePath(root, pathname) if (path === undefined) return const html = await readFile(path, 'utf8') const unlinked = html.replace(TWIN_LINK, '') - if (unlinked !== html) await writeFile(path, unlinked, 'utf8') + if (unlinked === html) { + throw new Error(`${path} has no markdown twin link to remove`) + } + await writeFile(path, unlinked, 'utf8') } async function readBuiltTwinSource( diff --git a/apps/website/src/lib/markdown-twin.test.ts b/apps/website/src/lib/markdown-twin.test.ts index a0d816c8777..a408650d6e1 100644 --- a/apps/website/src/lib/markdown-twin.test.ts +++ b/apps/website/src/lib/markdown-twin.test.ts @@ -338,12 +338,15 @@ describe('writeMarkdownTwins', () => { const route = `models/${modelSlug}/` const twinPath = `/models/${modelSlug}.md` - async function buildModelPage(main: string) { + async function buildModelPage( + main: string, + twinLink = `` + ) { const root = await mkdtemp(join(tmpdir(), 'twins-')) await mkdir(join(root, route), { recursive: true }) await writeFile( join(root, route, 'index.html'), - `${modelSlug}

Comfy home
${main}
` + `${modelSlug}${twinLink}
Comfy home
${main}
` ) return root } @@ -374,6 +377,28 @@ describe('writeMarkdownTwins', () => { expect(html).toContain('rel="canonical"') }) + it('drops the markdown link whatever its attribute order', async () => { + const root = await buildModelPage( + `${loadingSpinner}`, + `` + ) + + await writeMarkdownTwins(root, [route]) + + expect(await readPage(root)).not.toContain('text/markdown') + }) + + it('fails the build when a contentless page has no markdown link to drop', async () => { + const root = await buildModelPage( + `${loadingSpinner}`, + '' + ) + + await expect(writeMarkdownTwins(root, [route])).rejects.toThrow( + join(root, route, 'index.html') + ) + }) + it('twins the server-rendered hero and drops the spinner (post-FE-2942 shape)', async () => { const root = await buildModelPage( `

Provider

Model name

Model summary.

${loadingSpinner}` From 58805c39d74284d6ed2408018eb45194e481062e Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Wed, 30 Sep 2026 02:01:05 +0530 Subject: [PATCH 7/8] test(website): name the SSR model page shape post-FE-2942 (#18899) --- apps/website/src/lib/markdown-twin.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/website/src/lib/markdown-twin.test.ts b/apps/website/src/lib/markdown-twin.test.ts index a408650d6e1..3388e81748a 100644 --- a/apps/website/src/lib/markdown-twin.test.ts +++ b/apps/website/src/lib/markdown-twin.test.ts @@ -399,7 +399,7 @@ describe('writeMarkdownTwins', () => { ) }) - it('twins the server-rendered hero and drops the spinner (post-FE-2942 shape)', async () => { + it('twins the server-rendered hero and drops the spinner (post-FE-2942 (#18899) shape)', async () => { const root = await buildModelPage( `

Provider

Model name

Model summary.

${loadingSpinner}` ) From e064209e621f14d46d803bf2f98d3ac37f75b2b8 Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Wed, 30 Sep 2026 02:13:55 +0530 Subject: [PATCH 8/8] fix(website): fail the build only when a markdown twin link survives removal A page that never advertised a twin (rendered noindex) is a valid state, so unlinkTwin now leaves it alone and throws only when a link is still present after TWIN_LINK runs. --- apps/website/src/integrations/markdown-twins.ts | 6 +++--- apps/website/src/lib/markdown-twin.test.ts | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/apps/website/src/integrations/markdown-twins.ts b/apps/website/src/integrations/markdown-twins.ts index a587438735c..b9d3da592f9 100644 --- a/apps/website/src/integrations/markdown-twins.ts +++ b/apps/website/src/integrations/markdown-twins.ts @@ -85,10 +85,10 @@ async function unlinkTwin(root: string, pathname: string): Promise { if (path === undefined) return const html = await readFile(path, 'utf8') const unlinked = html.replace(TWIN_LINK, '') - if (unlinked === html) { - throw new Error(`${path} has no markdown twin link to remove`) + if (unlinked.includes('type="text/markdown"')) { + throw new Error(`${path} kept a markdown twin link TWIN_LINK did not match`) } - await writeFile(path, unlinked, 'utf8') + if (unlinked !== html) await writeFile(path, unlinked, 'utf8') } async function readBuiltTwinSource( diff --git a/apps/website/src/lib/markdown-twin.test.ts b/apps/website/src/lib/markdown-twin.test.ts index 3388e81748a..29b5c475bce 100644 --- a/apps/website/src/lib/markdown-twin.test.ts +++ b/apps/website/src/lib/markdown-twin.test.ts @@ -388,11 +388,24 @@ describe('writeMarkdownTwins', () => { expect(await readPage(root)).not.toContain('text/markdown') }) - it('fails the build when a contentless page has no markdown link to drop', async () => { + it('leaves a contentless page that never linked a twin untouched', async () => { const root = await buildModelPage( `${loadingSpinner}`, '' ) + const before = await readPage(root) + + const report = await writeMarkdownTwins(root, [route]) + + expect(report.skipped).toEqual([twinPath]) + expect(await readPage(root)).toBe(before) + }) + + it('fails the build when a contentless page keeps a markdown link it cannot drop', async () => { + const root = await buildModelPage( + `${loadingSpinner}`, + `` + ) await expect(writeMarkdownTwins(root, [route])).rejects.toThrow( join(root, route, 'index.html')