@getvitops/astro 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/schemas/Article.astro +4 -62
- package/src/schemas/Breadcrumb.astro +5 -19
- package/src/schemas/FAQ.astro +5 -21
- package/src/schemas/Organization.astro +4 -133
package/dist/index.d.mts
CHANGED
|
@@ -20,6 +20,14 @@ interface GetvitopsCssOptions {
|
|
|
20
20
|
format?: Format;
|
|
21
21
|
/** Directory the generated CSS is written to (default 'src/styles'). */
|
|
22
22
|
out?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Auto-inject the generated stylesheet into every SSR page (default true).
|
|
25
|
+
* Set false when other integrations add routes that must not inherit the
|
|
26
|
+
* design system (e.g. EmDash's `/_emdash/admin`) — then import the generated
|
|
27
|
+
* file (`<out>/tailwind.css` or `<out>/styles.css`) from your site layout so
|
|
28
|
+
* only your own pages (and previews rendered through them) are styled.
|
|
29
|
+
*/
|
|
30
|
+
inject?: boolean;
|
|
23
31
|
}
|
|
24
32
|
interface GetvitopsOptions {
|
|
25
33
|
favicon?: GetvitopsFaviconOptions;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/integration.ts"],"mappings":";;;;;UAuBiB,uBAAA;;EAEf,MAAA;EACA,YAAA;EAHe;EAKf,IAAA;;EAEA,UAAA;EACA,eAAA;AAAA;AAAA,UAGe,mBAAA;EAJf;EAMA,KAAA;EALe;EAOf,MAAA,GAAS,MAAM;EAJA;EAMf,GAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA,GAAU,uBAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/integration.ts"],"mappings":";;;;;UAuBiB,uBAAA;;EAEf,MAAA;EACA,YAAA;EAHe;EAKf,IAAA;;EAEA,UAAA;EACA,eAAA;AAAA;AAAA,UAGe,mBAAA;EAJf;EAMA,KAAA;EALe;EAOf,MAAA,GAAS,MAAM;EAJA;EAMf,GAAA;;;;;;;;EAQA,MAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA,GAAU,uBAAA;;EAEV,aAAA;EAFA;EAIA,GAAA,GAAM,mBAAmB;AAAA;AAAA,iBA0BH,SAAA,CAAU,IAAA,GAAM,gBAAA,GAAwB,gBAAgB"}
|
package/dist/index.mjs
CHANGED
|
@@ -91,9 +91,11 @@ function getvitops(opts = {}) {
|
|
|
91
91
|
if (format === "tailwind") plugins.push(...tailwindcss());
|
|
92
92
|
updateConfig({ vite: { plugins } });
|
|
93
93
|
const cssFile = format === "tailwind" ? "tailwind.css" : "styles.css";
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
if (opts.css.inject !== false) {
|
|
95
|
+
const cssPath = resolve(root, out, cssFile);
|
|
96
|
+
injectScript("page-ssr", `import ${JSON.stringify(cssPath)};`);
|
|
97
|
+
logger.info(`design-system CSS (${format}) auto-injected from ${out}/${cssFile}`);
|
|
98
|
+
} else logger.info(`design-system CSS (${format}) generated at ${out}/${cssFile} (inject: false — import it from your layout)`);
|
|
97
99
|
}
|
|
98
100
|
} }
|
|
99
101
|
};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/integration.ts"],"sourcesContent":["/**\n * @getvitops/astro — the Astro integration. One entry wires the design system's\n * `<head>` contributions into a consumer site:\n * - favicons + PWA manifest (generated into public/),\n * - the web-component runtime bundles (copied into public/vitops/),\n * - (opt-in) the design-system CSS, generated + auto-injected (no manual import).\n * The `<Head />` component (shipped alongside) renders the tags, reading resolved\n * config from the `virtual:getvitops/head` module this integration provides.\n */\nimport { cpSync, existsSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Format } from '@getvitops/generator';\nimport {\n type FaviconLink,\n faviconLinks,\n generateFavicons,\n writeFaviconManifest,\n} from '@getvitops/utils';\nimport vitops from '@getvitops/vite';\nimport tailwindcss from '@tailwindcss/vite';\nimport type { AstroIntegration } from 'astro';\n\nexport interface GetvitopsFaviconOptions {\n /** Source SVG or PNG. */\n source: string;\n lowResSource?: string;\n /** App name → enables `site.webmanifest`. */\n name?: string;\n /** PWA theme color (also `<meta name=\"theme-color\">`). */\n themeColor?: string;\n backgroundColor?: string;\n}\n\nexport interface GetvitopsCssOptions {\n /** Path to design-system.json (default 'design-system.json'). */\n input?: string;\n /** Output format (default 'tailwind'). */\n format?: Format;\n /** Directory the generated CSS is written to (default 'src/styles'). */\n out?: string;\n}\n\nexport interface GetvitopsOptions {\n favicon?: GetvitopsFaviconOptions;\n /** Copy + link the web-component bundles (default true). */\n webComponents?: boolean;\n /** Generate + auto-inject the design-system CSS. Off unless provided. */\n css?: GetvitopsCssOptions;\n}\n\ninterface HeadData {\n favicons: boolean;\n faviconLinks: FaviconLink[];\n themeColor: string | null;\n webComponents: boolean;\n wcBase: string;\n}\n\nconst VIRTUAL_ID = 'virtual:getvitops/head';\nconst RESOLVED_ID = `\\0${VIRTUAL_ID}`;\n\nfunction virtualHeadPlugin(data: HeadData) {\n return {\n name: '@getvitops/astro:virtual-head',\n resolveId(id: string) {\n return id === VIRTUAL_ID ? RESOLVED_ID : null;\n },\n load(id: string) {\n return id === RESOLVED_ID ? `export default ${JSON.stringify(data)};` : null;\n },\n };\n}\n\nexport default function getvitops(opts: GetvitopsOptions = {}): AstroIntegration {\n return {\n name: '@getvitops/astro',\n hooks: {\n 'astro:config:setup': async ({ config, updateConfig, injectScript, logger }) => {\n const root = fileURLToPath(config.root);\n const publicDir = fileURLToPath(config.publicDir);\n const webComponents = opts.webComponents !== false;\n const hasManifest = !!(opts.favicon?.name && opts.favicon?.themeColor);\n let hasSvg = false;\n\n // 1. Favicons + manifest → public/\n if (opts.favicon) {\n const source = resolve(root, opts.favicon.source);\n hasSvg = source.endsWith('.svg');\n await generateFavicons({\n source,\n outputDir: publicDir,\n ...(opts.favicon.lowResSource\n ? { lowResSource: resolve(root, opts.favicon.lowResSource) }\n : {}),\n });\n if (opts.favicon.name && opts.favicon.themeColor) {\n await writeFaviconManifest(publicDir, {\n name: opts.favicon.name,\n themeColor: opts.favicon.themeColor,\n ...(opts.favicon.backgroundColor\n ? { backgroundColor: opts.favicon.backgroundColor }\n : {}),\n });\n }\n logger.info('generated favicons + manifest → public/');\n }\n\n // 2. Web-component bundles → public/vitops/\n if (webComponents) {\n const corePkg = fileURLToPath(import.meta.resolve('@getvitops/core/package.json'));\n const coreDist = join(dirname(corePkg), 'dist');\n const dest = join(publicDir, 'vitops');\n if (existsSync(coreDist)) {\n for (const f of ['polyfills.js', 'deferred.js', 'elements.js', 'polyfills']) {\n const src = join(coreDist, f);\n if (existsSync(src)) cpSync(src, join(dest, f), { recursive: true });\n }\n logger.info('copied web-component bundles → public/vitops/');\n } else {\n logger.warn(\n `@getvitops/core dist not found (${coreDist}); run build:core. Skipping WC copy.`,\n );\n }\n }\n\n // 3. Virtual head module for <Head/>\n updateConfig({\n vite: {\n plugins: [\n virtualHeadPlugin({\n favicons: !!opts.favicon,\n faviconLinks: opts.favicon ? faviconLinks({ hasSvg, manifest: hasManifest }) : [],\n themeColor: opts.favicon?.themeColor ?? null,\n webComponents,\n wcBase: '/vitops',\n }),\n ],\n },\n });\n\n // 4. CSS — generate + compile + auto-inject (consumer imports nothing).\n if (opts.css) {\n const format: Format = opts.css.format ?? 'tailwind';\n const out = opts.css.out ?? 'src/styles';\n const plugins = [vitops({ input: opts.css.input ?? 'design-system.json', format, out })];\n // tailwindcss() is typed against a newer vite than @getvitops/vite's\n // peer; the Plugin shapes are structurally compatible at runtime\n // (Astro forwards them verbatim), so bridge the two type identities.\n if (format === 'tailwind') plugins.push(...(tailwindcss() as unknown as typeof plugins));\n updateConfig({ vite: { plugins } });\n const cssFile = format === 'tailwind' ? 'tailwind.css' : 'styles.css';\n const cssPath = resolve(root, out, cssFile);\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/integration.ts"],"sourcesContent":["/**\n * @getvitops/astro — the Astro integration. One entry wires the design system's\n * `<head>` contributions into a consumer site:\n * - favicons + PWA manifest (generated into public/),\n * - the web-component runtime bundles (copied into public/vitops/),\n * - (opt-in) the design-system CSS, generated + auto-injected (no manual import).\n * The `<Head />` component (shipped alongside) renders the tags, reading resolved\n * config from the `virtual:getvitops/head` module this integration provides.\n */\nimport { cpSync, existsSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Format } from '@getvitops/generator';\nimport {\n type FaviconLink,\n faviconLinks,\n generateFavicons,\n writeFaviconManifest,\n} from '@getvitops/utils';\nimport vitops from '@getvitops/vite';\nimport tailwindcss from '@tailwindcss/vite';\nimport type { AstroIntegration } from 'astro';\n\nexport interface GetvitopsFaviconOptions {\n /** Source SVG or PNG. */\n source: string;\n lowResSource?: string;\n /** App name → enables `site.webmanifest`. */\n name?: string;\n /** PWA theme color (also `<meta name=\"theme-color\">`). */\n themeColor?: string;\n backgroundColor?: string;\n}\n\nexport interface GetvitopsCssOptions {\n /** Path to design-system.json (default 'design-system.json'). */\n input?: string;\n /** Output format (default 'tailwind'). */\n format?: Format;\n /** Directory the generated CSS is written to (default 'src/styles'). */\n out?: string;\n /**\n * Auto-inject the generated stylesheet into every SSR page (default true).\n * Set false when other integrations add routes that must not inherit the\n * design system (e.g. EmDash's `/_emdash/admin`) — then import the generated\n * file (`<out>/tailwind.css` or `<out>/styles.css`) from your site layout so\n * only your own pages (and previews rendered through them) are styled.\n */\n inject?: boolean;\n}\n\nexport interface GetvitopsOptions {\n favicon?: GetvitopsFaviconOptions;\n /** Copy + link the web-component bundles (default true). */\n webComponents?: boolean;\n /** Generate + auto-inject the design-system CSS. Off unless provided. */\n css?: GetvitopsCssOptions;\n}\n\ninterface HeadData {\n favicons: boolean;\n faviconLinks: FaviconLink[];\n themeColor: string | null;\n webComponents: boolean;\n wcBase: string;\n}\n\nconst VIRTUAL_ID = 'virtual:getvitops/head';\nconst RESOLVED_ID = `\\0${VIRTUAL_ID}`;\n\nfunction virtualHeadPlugin(data: HeadData) {\n return {\n name: '@getvitops/astro:virtual-head',\n resolveId(id: string) {\n return id === VIRTUAL_ID ? RESOLVED_ID : null;\n },\n load(id: string) {\n return id === RESOLVED_ID ? `export default ${JSON.stringify(data)};` : null;\n },\n };\n}\n\nexport default function getvitops(opts: GetvitopsOptions = {}): AstroIntegration {\n return {\n name: '@getvitops/astro',\n hooks: {\n 'astro:config:setup': async ({ config, updateConfig, injectScript, logger }) => {\n const root = fileURLToPath(config.root);\n const publicDir = fileURLToPath(config.publicDir);\n const webComponents = opts.webComponents !== false;\n const hasManifest = !!(opts.favicon?.name && opts.favicon?.themeColor);\n let hasSvg = false;\n\n // 1. Favicons + manifest → public/\n if (opts.favicon) {\n const source = resolve(root, opts.favicon.source);\n hasSvg = source.endsWith('.svg');\n await generateFavicons({\n source,\n outputDir: publicDir,\n ...(opts.favicon.lowResSource\n ? { lowResSource: resolve(root, opts.favicon.lowResSource) }\n : {}),\n });\n if (opts.favicon.name && opts.favicon.themeColor) {\n await writeFaviconManifest(publicDir, {\n name: opts.favicon.name,\n themeColor: opts.favicon.themeColor,\n ...(opts.favicon.backgroundColor\n ? { backgroundColor: opts.favicon.backgroundColor }\n : {}),\n });\n }\n logger.info('generated favicons + manifest → public/');\n }\n\n // 2. Web-component bundles → public/vitops/\n if (webComponents) {\n const corePkg = fileURLToPath(import.meta.resolve('@getvitops/core/package.json'));\n const coreDist = join(dirname(corePkg), 'dist');\n const dest = join(publicDir, 'vitops');\n if (existsSync(coreDist)) {\n for (const f of ['polyfills.js', 'deferred.js', 'elements.js', 'polyfills']) {\n const src = join(coreDist, f);\n if (existsSync(src)) cpSync(src, join(dest, f), { recursive: true });\n }\n logger.info('copied web-component bundles → public/vitops/');\n } else {\n logger.warn(\n `@getvitops/core dist not found (${coreDist}); run build:core. Skipping WC copy.`,\n );\n }\n }\n\n // 3. Virtual head module for <Head/>\n updateConfig({\n vite: {\n plugins: [\n virtualHeadPlugin({\n favicons: !!opts.favicon,\n faviconLinks: opts.favicon ? faviconLinks({ hasSvg, manifest: hasManifest }) : [],\n themeColor: opts.favicon?.themeColor ?? null,\n webComponents,\n wcBase: '/vitops',\n }),\n ],\n },\n });\n\n // 4. CSS — generate + compile + auto-inject (consumer imports nothing).\n if (opts.css) {\n const format: Format = opts.css.format ?? 'tailwind';\n const out = opts.css.out ?? 'src/styles';\n const plugins = [vitops({ input: opts.css.input ?? 'design-system.json', format, out })];\n // tailwindcss() is typed against a newer vite than @getvitops/vite's\n // peer; the Plugin shapes are structurally compatible at runtime\n // (Astro forwards them verbatim), so bridge the two type identities.\n if (format === 'tailwind') plugins.push(...(tailwindcss() as unknown as typeof plugins));\n updateConfig({ vite: { plugins } });\n const cssFile = format === 'tailwind' ? 'tailwind.css' : 'styles.css';\n if (opts.css.inject !== false) {\n const cssPath = resolve(root, out, cssFile);\n injectScript('page-ssr', `import ${JSON.stringify(cssPath)};`);\n logger.info(`design-system CSS (${format}) auto-injected from ${out}/${cssFile}`);\n } else {\n logger.info(\n `design-system CSS (${format}) generated at ${out}/${cssFile} (inject: false — import it from your layout)`,\n );\n }\n }\n },\n },\n };\n}\n"],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getvitops/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Astro integration for the Vitops design system — favicons/PWA, web-component scripts, and CSS, via a getvitops() integration + <Head /> component.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@tailwindcss/vite": "^4.3.3",
|
|
42
42
|
"tailwindcss": "^4.3.3",
|
|
43
|
-
"@getvitops/generator": "0.
|
|
44
|
-
"@getvitops/core": "0.
|
|
45
|
-
"@getvitops/
|
|
46
|
-
"@getvitops/
|
|
43
|
+
"@getvitops/generator": "0.4.0",
|
|
44
|
+
"@getvitops/core": "0.4.0",
|
|
45
|
+
"@getvitops/utils": "0.4.0",
|
|
46
|
+
"@getvitops/vite": "0.4.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"astro": "^7.1.2"
|
|
@@ -1,68 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
description?: string;
|
|
5
|
-
image?: string | string[];
|
|
6
|
-
datePublished: string;
|
|
7
|
-
dateModified?: string;
|
|
8
|
-
author: {
|
|
9
|
-
name: string;
|
|
10
|
-
url?: string;
|
|
11
|
-
} | {
|
|
12
|
-
name: string;
|
|
13
|
-
url?: string;
|
|
14
|
-
}[];
|
|
15
|
-
publisher?: {
|
|
16
|
-
name: string;
|
|
17
|
-
logo?: string;
|
|
18
|
-
};
|
|
19
|
-
mainEntityOfPage?: string;
|
|
20
|
-
articleSection?: string;
|
|
21
|
-
wordCount?: number;
|
|
22
|
-
keywords?: string[];
|
|
23
|
-
}
|
|
2
|
+
import { articleGraph } from '@getvitops/utils';
|
|
3
|
+
import type { ArticleGraphOptions } from '@getvitops/utils';
|
|
24
4
|
|
|
25
|
-
|
|
26
|
-
headline,
|
|
27
|
-
description,
|
|
28
|
-
image,
|
|
29
|
-
datePublished,
|
|
30
|
-
dateModified,
|
|
31
|
-
author,
|
|
32
|
-
publisher,
|
|
33
|
-
mainEntityOfPage,
|
|
34
|
-
articleSection,
|
|
35
|
-
wordCount,
|
|
36
|
-
keywords,
|
|
37
|
-
} = Astro.props;
|
|
5
|
+
export type Props = ArticleGraphOptions;
|
|
38
6
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
const jsonLd = {
|
|
42
|
-
'@context': 'https://schema.org',
|
|
43
|
-
'@type': 'Article',
|
|
44
|
-
headline,
|
|
45
|
-
...(description && { description }),
|
|
46
|
-
...(image && { image: Array.isArray(image) ? image : [image] }),
|
|
47
|
-
datePublished,
|
|
48
|
-
...(dateModified && { dateModified }),
|
|
49
|
-
author: authors.map(a => ({
|
|
50
|
-
'@type': 'Person',
|
|
51
|
-
name: a.name,
|
|
52
|
-
...(a.url && { url: a.url }),
|
|
53
|
-
})),
|
|
54
|
-
...(publisher && {
|
|
55
|
-
publisher: {
|
|
56
|
-
'@type': 'Organization',
|
|
57
|
-
name: publisher.name,
|
|
58
|
-
...(publisher.logo && { logo: { '@type': 'ImageObject', url: publisher.logo } }),
|
|
59
|
-
},
|
|
60
|
-
}),
|
|
61
|
-
...(mainEntityOfPage && { mainEntityOfPage: { '@type': 'WebPage', '@id': mainEntityOfPage } }),
|
|
62
|
-
...(articleSection && { articleSection }),
|
|
63
|
-
...(wordCount && { wordCount }),
|
|
64
|
-
...(keywords && { keywords: keywords.join(', ') }),
|
|
65
|
-
};
|
|
7
|
+
const jsonLd = articleGraph(Astro.props);
|
|
66
8
|
---
|
|
67
9
|
|
|
68
10
|
<script is:inline type="application/ld+json" set:html={JSON.stringify(jsonLd)} />
|
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
url: string;
|
|
5
|
-
}
|
|
2
|
+
import { breadcrumbGraph } from '@getvitops/utils';
|
|
3
|
+
import type { BreadcrumbGraphOptions, BreadcrumbItem } from '@getvitops/utils';
|
|
6
4
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
}
|
|
5
|
+
export type { BreadcrumbItem };
|
|
6
|
+
export type Props = BreadcrumbGraphOptions;
|
|
10
7
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const jsonLd = {
|
|
14
|
-
'@context': 'https://schema.org',
|
|
15
|
-
'@type': 'BreadcrumbList',
|
|
16
|
-
itemListElement: items.map((item, index) => ({
|
|
17
|
-
'@type': 'ListItem',
|
|
18
|
-
position: index + 1,
|
|
19
|
-
name: item.name,
|
|
20
|
-
item: item.url,
|
|
21
|
-
})),
|
|
22
|
-
};
|
|
8
|
+
const jsonLd = breadcrumbGraph(Astro.props);
|
|
23
9
|
---
|
|
24
10
|
|
|
25
11
|
<script is:inline type="application/ld+json" set:html={JSON.stringify(jsonLd)} />
|
package/src/schemas/FAQ.astro
CHANGED
|
@@ -5,29 +5,13 @@
|
|
|
5
5
|
* NOTE: Google recommends FAQ markup only for authoritative government
|
|
6
6
|
* and health sites. For other sites, consider using QAPage schema instead.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
answer: string;
|
|
11
|
-
}
|
|
8
|
+
import { faqGraph } from '@getvitops/utils';
|
|
9
|
+
import type { FAQGraphOptions, FAQItem } from '@getvitops/utils';
|
|
12
10
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
}
|
|
11
|
+
export type { FAQItem };
|
|
12
|
+
export type Props = FAQGraphOptions;
|
|
16
13
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const jsonLd = {
|
|
20
|
-
'@context': 'https://schema.org',
|
|
21
|
-
'@type': 'FAQPage',
|
|
22
|
-
mainEntity: items.map(item => ({
|
|
23
|
-
'@type': 'Question',
|
|
24
|
-
name: item.question,
|
|
25
|
-
acceptedAnswer: {
|
|
26
|
-
'@type': 'Answer',
|
|
27
|
-
text: item.answer,
|
|
28
|
-
},
|
|
29
|
-
})),
|
|
30
|
-
};
|
|
14
|
+
const jsonLd = faqGraph(Astro.props);
|
|
31
15
|
---
|
|
32
16
|
|
|
33
17
|
<script is:inline type="application/ld+json" set:html={JSON.stringify(jsonLd)} />
|
|
@@ -1,139 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
url?: string;
|
|
5
|
-
logo?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
email?: string;
|
|
8
|
-
telephone?: string;
|
|
9
|
-
address?: {
|
|
10
|
-
streetAddress?: string;
|
|
11
|
-
addressLocality?: string;
|
|
12
|
-
addressRegion?: string;
|
|
13
|
-
postalCode?: string;
|
|
14
|
-
addressCountry?: string;
|
|
15
|
-
};
|
|
16
|
-
sameAs?: string[];
|
|
17
|
-
foundingDate?: string;
|
|
18
|
-
founders?: string[];
|
|
19
|
-
numberOfEmployees?: number | { minValue: number; maxValue: number };
|
|
20
|
-
parentOrganization?: {
|
|
21
|
-
name: string;
|
|
22
|
-
url?: string;
|
|
23
|
-
};
|
|
24
|
-
subOrganization?: {
|
|
25
|
-
name: string;
|
|
26
|
-
url?: string;
|
|
27
|
-
}[];
|
|
28
|
-
contactPoint?: {
|
|
29
|
-
type?: 'customer service' | 'technical support' | 'sales' | 'billing support' | 'reservations';
|
|
30
|
-
telephone: string;
|
|
31
|
-
email?: string;
|
|
32
|
-
contactType: string;
|
|
33
|
-
availableLanguage?: string[];
|
|
34
|
-
areaServed?: string[];
|
|
35
|
-
}[];
|
|
36
|
-
areaServed?: string[];
|
|
37
|
-
brand?: string;
|
|
38
|
-
award?: string[];
|
|
39
|
-
memberOf?: {
|
|
40
|
-
name: string;
|
|
41
|
-
url?: string;
|
|
42
|
-
}[];
|
|
43
|
-
}
|
|
2
|
+
import { organizationGraph } from '@getvitops/utils';
|
|
3
|
+
import type { OrganizationGraphOptions } from '@getvitops/utils';
|
|
44
4
|
|
|
45
|
-
|
|
46
|
-
name,
|
|
47
|
-
url,
|
|
48
|
-
logo,
|
|
49
|
-
description,
|
|
50
|
-
email,
|
|
51
|
-
telephone,
|
|
52
|
-
address,
|
|
53
|
-
sameAs,
|
|
54
|
-
foundingDate,
|
|
55
|
-
founders,
|
|
56
|
-
numberOfEmployees,
|
|
57
|
-
parentOrganization,
|
|
58
|
-
subOrganization,
|
|
59
|
-
contactPoint,
|
|
60
|
-
areaServed,
|
|
61
|
-
brand,
|
|
62
|
-
award,
|
|
63
|
-
memberOf,
|
|
64
|
-
} = Astro.props;
|
|
5
|
+
export type Props = OrganizationGraphOptions;
|
|
65
6
|
|
|
66
|
-
const jsonLd =
|
|
67
|
-
'@context': 'https://schema.org',
|
|
68
|
-
'@type': 'Organization',
|
|
69
|
-
name,
|
|
70
|
-
...(url && { url }),
|
|
71
|
-
...(logo && { logo }),
|
|
72
|
-
...(description && { description }),
|
|
73
|
-
...(email && { email }),
|
|
74
|
-
...(telephone && { telephone }),
|
|
75
|
-
...(address && {
|
|
76
|
-
address: {
|
|
77
|
-
'@type': 'PostalAddress',
|
|
78
|
-
...(address.streetAddress && { streetAddress: address.streetAddress }),
|
|
79
|
-
...(address.addressLocality && { addressLocality: address.addressLocality }),
|
|
80
|
-
...(address.addressRegion && { addressRegion: address.addressRegion }),
|
|
81
|
-
...(address.postalCode && { postalCode: address.postalCode }),
|
|
82
|
-
...(address.addressCountry && { addressCountry: address.addressCountry }),
|
|
83
|
-
},
|
|
84
|
-
}),
|
|
85
|
-
...(sameAs && { sameAs }),
|
|
86
|
-
...(foundingDate && { foundingDate }),
|
|
87
|
-
...(founders && {
|
|
88
|
-
founders: founders.map(f => ({
|
|
89
|
-
'@type': 'Person',
|
|
90
|
-
name: f,
|
|
91
|
-
})),
|
|
92
|
-
}),
|
|
93
|
-
...(numberOfEmployees && {
|
|
94
|
-
numberOfEmployees: typeof numberOfEmployees === 'number'
|
|
95
|
-
? { '@type': 'QuantitativeValue', value: numberOfEmployees }
|
|
96
|
-
: {
|
|
97
|
-
'@type': 'QuantitativeValue',
|
|
98
|
-
minValue: numberOfEmployees.minValue,
|
|
99
|
-
maxValue: numberOfEmployees.maxValue,
|
|
100
|
-
},
|
|
101
|
-
}),
|
|
102
|
-
...(parentOrganization && {
|
|
103
|
-
parentOrganization: {
|
|
104
|
-
'@type': 'Organization',
|
|
105
|
-
name: parentOrganization.name,
|
|
106
|
-
...(parentOrganization.url && { url: parentOrganization.url }),
|
|
107
|
-
},
|
|
108
|
-
}),
|
|
109
|
-
...(subOrganization && {
|
|
110
|
-
subOrganization: subOrganization.map(sub => ({
|
|
111
|
-
'@type': 'Organization',
|
|
112
|
-
name: sub.name,
|
|
113
|
-
...(sub.url && { url: sub.url }),
|
|
114
|
-
})),
|
|
115
|
-
}),
|
|
116
|
-
...(contactPoint && {
|
|
117
|
-
contactPoint: contactPoint.map(cp => ({
|
|
118
|
-
'@type': 'ContactPoint',
|
|
119
|
-
telephone: cp.telephone,
|
|
120
|
-
contactType: cp.contactType,
|
|
121
|
-
...(cp.email && { email: cp.email }),
|
|
122
|
-
...(cp.availableLanguage && { availableLanguage: cp.availableLanguage }),
|
|
123
|
-
...(cp.areaServed && { areaServed: cp.areaServed }),
|
|
124
|
-
})),
|
|
125
|
-
}),
|
|
126
|
-
...(areaServed && { areaServed }),
|
|
127
|
-
...(brand && { brand: { '@type': 'Brand', name: brand } }),
|
|
128
|
-
...(award && { award }),
|
|
129
|
-
...(memberOf && {
|
|
130
|
-
memberOf: memberOf.map(m => ({
|
|
131
|
-
'@type': 'Organization',
|
|
132
|
-
name: m.name,
|
|
133
|
-
...(m.url && { url: m.url }),
|
|
134
|
-
})),
|
|
135
|
-
}),
|
|
136
|
-
};
|
|
7
|
+
const jsonLd = organizationGraph(Astro.props);
|
|
137
8
|
---
|
|
138
9
|
|
|
139
10
|
<script is:inline type="application/ld+json" set:html={JSON.stringify(jsonLd)} />
|