Repository navigation
feat(website): build model page JSON-LD, inert while pages are noindex #18890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
15be10b
feat(website): build model page JSON-LD, inert while pages are noindex
MaanilVerma f9c5c7d
fix(website): skip a model Offer when the price is not finite
MaanilVerma 242ea82
refactor(website): give SoftwareApplication one typed author input
MaanilVerma a5c261a
test(website): assert the model developer url in JSON-LD
MaanilVerma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| export interface ModelDeveloper { | ||
| readonly name: string | ||
| readonly url: string | ||
| readonly wikidata?: string | ||
| } | ||
|
|
||
| const alibabaCloud: ModelDeveloper = { | ||
| name: 'Alibaba Cloud', | ||
| url: 'https://www.alibabacloud.com/', | ||
| wikidata: 'Q17062154' | ||
| } | ||
|
|
||
| /** | ||
| * Catalogue provider label to the organisation that developed its models. | ||
| * `null` marks a host whose model developer is not yet known. Wikidata ids were | ||
| * checked on 2026-09-25; developers without an organisation entry have none. | ||
| */ | ||
| export const MODEL_DEVELOPERS: Readonly<Record<string, ModelDeveloper | null>> = | ||
| { | ||
| Beeble: { name: 'Beeble', url: 'https://beeble.ai/' }, | ||
| 'Black Forest Labs': { | ||
| name: 'Black Forest Labs', | ||
| url: 'https://bfl.ai/', | ||
| wikidata: 'Q128801641' | ||
| }, | ||
| Bria: { name: 'Bria', url: 'https://bria.ai/' }, | ||
| ByteDance: { | ||
| name: 'ByteDance', | ||
| url: 'https://www.bytedance.com/', | ||
| wikidata: 'Q55606242' | ||
| }, | ||
| ElevenLabs: { | ||
| name: 'ElevenLabs', | ||
| url: 'https://elevenlabs.io/', | ||
| wikidata: 'Q116798355' | ||
| }, | ||
| Freepik: { | ||
| name: 'Freepik', | ||
| url: 'https://www.freepik.com/', | ||
| wikidata: 'Q97573128' | ||
| }, | ||
| Google: { | ||
| name: 'Google DeepMind', | ||
| url: 'https://deepmind.google/', | ||
| wikidata: 'Q15733006' | ||
| }, | ||
| Heygen: { | ||
| name: 'HeyGen', | ||
| url: 'https://www.heygen.com/', | ||
| wikidata: 'Q123258741' | ||
| }, | ||
| Ideogram: { name: 'Ideogram', url: 'https://ideogram.ai/' }, | ||
| Kling: { | ||
| name: 'Kuaishou', | ||
| url: 'https://www.kuaishou.com/', | ||
| wikidata: 'Q47015540' | ||
| }, | ||
| Krea: { name: 'Krea', url: 'https://www.krea.ai/', wikidata: 'Q135906383' }, | ||
| Luma: { name: 'Luma AI', url: 'https://lumalabs.ai/' }, | ||
| OpenAI: { | ||
| name: 'OpenAI', | ||
| url: 'https://openai.com/', | ||
| wikidata: 'Q21708200' | ||
| }, | ||
| Qwen: alibabaCloud, | ||
| Recraft: { name: 'Recraft', url: 'https://www.recraft.ai/' }, | ||
| Runway: { | ||
| name: 'Runway', | ||
| url: 'https://runwayml.com/', | ||
| wikidata: 'Q123367593' | ||
| }, | ||
| Wan: alibabaCloud, | ||
|
benjcooley marked this conversation as resolved.
Resolved
|
||
| WaveSpeed: null, | ||
| xAI: { name: 'xAI', url: 'https://x.ai/', wikidata: 'Q120599684' } | ||
| } | ||
|
|
||
| export function modelDeveloper( | ||
| provider: string | undefined | ||
| ): ModelDeveloper | undefined { | ||
| if (!provider || !Object.hasOwn(MODEL_DEVELOPERS, provider)) return undefined | ||
|
MaanilVerma marked this conversation as resolved.
Resolved
|
||
| return MODEL_DEVELOPERS[provider] ?? undefined | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
|
|
||
| import { MODEL_DEVELOPERS, modelDeveloper } from '../config/model-vendors' | ||
| import { | ||
| getWorkshopPageDetail, | ||
| workshopPagePaths | ||
| } from '../config/workshop-page-content' | ||
| import type { JsonLdNode } from './jsonLd' | ||
| import { modelPageJsonLd } from './modelJsonLd' | ||
|
|
||
| const siteUrl = 'https://comfy.org' | ||
| const url = 'https://comfy.org/models/example/' | ||
|
|
||
| const imageModel = { | ||
| name: 'FLUX 2 Max Text-to-Image', | ||
| summary: 'Generates an image from text.', | ||
| thumbnail: { url: 'https://cdn.example/flux.png', kind: 'image' as const } | ||
| } | ||
| const videoModel = { | ||
| name: 'Seedance 2.5 Text-to-Video', | ||
| summary: 'Generates a video from text.', | ||
| thumbnail: { url: 'https://cdn.example/seedance.mp4', kind: 'video' as const } | ||
| } | ||
|
|
||
| function software( | ||
| input: Partial<Parameters<typeof modelPageJsonLd>[0]> | ||
| ): JsonLdNode { | ||
| const [node] = modelPageJsonLd({ | ||
| model: imageModel, | ||
| url, | ||
| siteUrl, | ||
| developer: modelDeveloper('Black Forest Labs'), | ||
| ...input | ||
| }).extraJsonLd | ||
| return node | ||
| } | ||
|
|
||
| describe('modelPageJsonLd', () => { | ||
| it('describes the page as Home > Models > model with the app as main entity', () => { | ||
| const result = modelPageJsonLd({ | ||
| model: imageModel, | ||
| useCaseLabel: 'Generate images', | ||
| url, | ||
| siteUrl, | ||
| developer: modelDeveloper('Black Forest Labs') | ||
| }) | ||
| expect(result.pageType).toBe('WebPage') | ||
| expect(result.mainEntityId).toBe(`${url}#software`) | ||
| expect(result.breadcrumbs).toEqual([ | ||
| { name: 'Home', url: 'https://comfy.org/' }, | ||
| { name: 'Models', url: 'https://comfy.org/models/' }, | ||
| { name: 'FLUX 2 Max Text-to-Image' } | ||
| ]) | ||
| expect(result.extraJsonLd[0]).toMatchObject({ | ||
| '@type': 'SoftwareApplication', | ||
| '@id': `${url}#software`, | ||
| name: 'FLUX 2 Max Text-to-Image', | ||
| description: 'Generates an image from text.', | ||
| applicationCategory: 'MultimediaApplication', | ||
| applicationSubCategory: 'Generate images', | ||
| operatingSystem: 'Web', | ||
| provider: { '@id': 'https://comfy.org/#organization' }, | ||
| mainEntityOfPage: url, | ||
| author: { | ||
| '@type': 'Organization', | ||
| name: 'Black Forest Labs', | ||
| url: 'https://bfl.ai/', | ||
| sameAs: ['https://www.wikidata.org/wiki/Q128801641'] | ||
| } | ||
| }) | ||
| }) | ||
|
|
||
| it.for([ | ||
| ['an image thumbnail', imageModel, 'https://cdn.example/flux.png'], | ||
| ['a video thumbnail', videoModel, undefined] | ||
| ] as const)('sets image from %s', ([, model, image]) => { | ||
| expect(software({ model }).image).toBe(image) | ||
| }) | ||
|
|
||
| it.for([ | ||
| ['WaveSpeed, a host', 'WaveSpeed'], | ||
| ['an unknown provider', 'Someone New'], | ||
| ['no provider', undefined] | ||
| ] as const)('omits the author for %s', ([, provider]) => { | ||
| expect(software({ developer: modelDeveloper(provider) }).author).toBe( | ||
| undefined | ||
| ) | ||
| }) | ||
|
|
||
| it.for([ | ||
| ['no price', undefined, undefined], | ||
| ['a zero price', 0, undefined], | ||
| ['a sub-cent price, kept above $0', 0.57 / 211, '0.002701'], | ||
| ['a non-finite price', Infinity, undefined], | ||
| ['a dollar price, to the cent', 1.5, '1.5'], | ||
| ['a large price, to the cent', 1234.5678, '1234.57'] | ||
| ] as const)('handles %s', ([, usd, price]) => { | ||
| const node = software({ | ||
| price: usd === undefined ? undefined : { usd, settings: '1024x1024' } | ||
| }) | ||
| expect(node.offers).toEqual( | ||
| price === undefined ? undefined : expect.objectContaining({ price }) | ||
| ) | ||
| }) | ||
|
|
||
| it('states the priced settings on the offer', () => { | ||
| expect( | ||
| software({ price: { usd: 0.04, settings: '1024x1024' } }).offers | ||
| ).toEqual({ | ||
| '@type': 'Offer', | ||
| price: '0.04', | ||
| priceCurrency: 'USD', | ||
| priceSpecification: { | ||
| '@type': 'UnitPriceSpecification', | ||
| price: '0.04', | ||
| priceCurrency: 'USD', | ||
| description: '1024x1024' | ||
| } | ||
| }) | ||
| }) | ||
| }) | ||
|
|
||
| describe('MODEL_DEVELOPERS', () => { | ||
| it('has a row for every catalogue provider', () => { | ||
| const providers = new Set( | ||
| workshopPagePaths.flatMap( | ||
| (slug) => getWorkshopPageDetail(slug)?.provider ?? [] | ||
| ) | ||
| ) | ||
| expect( | ||
| [...providers].filter((p) => !Object.hasOwn(MODEL_DEVELOPERS, p)) | ||
| ).toEqual([]) | ||
| }) | ||
|
|
||
| it('links only well-formed Wikidata ids', () => { | ||
| for (const developer of Object.values(MODEL_DEVELOPERS)) | ||
| if (developer?.wikidata) expect(developer.wikidata).toMatch(/^Q\d+$/) | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.