MCPcopy Create free account
hub / github.com/apisyouwonthate/openapi.tools / createCollectionPageSchema

Function createCollectionPageSchema

src/utils/structuredData.ts:99–122  ·  view source on GitHub ↗
(data: {
  name: string;
  description: string;
  url: string;
  tools: Array<{ name: string; url: string }>;
})

Source from the content-addressed store, hash-verified

97 * Generate CollectionPage structured data for category and collection pages
98 */
99export function createCollectionPageSchema(data: {
100 name: string;
101 description: string;
102 url: string;
103 tools: Array<{ name: string; url: string }>;
104}): WithContext<CollectionPage> {
105 return {
106 '@context': 'https://schema.org',
107 '@type': 'CollectionPage',
108 name: data.name,
109 description: data.description,
110 url: data.url,
111 mainEntity: {
112 '@type': 'ItemList',
113 numberOfItems: data.tools.length,
114 itemListElement: data.tools.slice(0, 10).map((tool, index) => ({
115 '@type': 'ListItem' as const,
116 position: index + 1,
117 name: tool.name,
118 url: tool.url,
119 })),
120 },
121 };
122}
123
124/**
125 * Generate FAQPage structured data for category pages

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected