@getvitops/astro 0.3.0 → 0.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getvitops/astro",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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.3.0",
44
- "@getvitops/core": "0.3.0",
45
- "@getvitops/vite": "0.3.0",
46
- "@getvitops/utils": "0.3.0"
43
+ "@getvitops/core": "0.4.0",
44
+ "@getvitops/generator": "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
- export interface Props {
3
- headline: string;
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
- const {
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 authors = Array.isArray(author) ? author : [author];
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
- export interface BreadcrumbItem {
3
- name: string;
4
- url: string;
5
- }
2
+ import { breadcrumbGraph } from '@getvitops/utils';
3
+ import type { BreadcrumbGraphOptions, BreadcrumbItem } from '@getvitops/utils';
6
4
 
7
- export interface Props {
8
- items: BreadcrumbItem[];
9
- }
5
+ export type { BreadcrumbItem };
6
+ export type Props = BreadcrumbGraphOptions;
10
7
 
11
- const { items } = Astro.props;
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)} />
@@ -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
- export interface FAQItem {
9
- question: string;
10
- answer: string;
11
- }
8
+ import { faqGraph } from '@getvitops/utils';
9
+ import type { FAQGraphOptions, FAQItem } from '@getvitops/utils';
12
10
 
13
- export interface Props {
14
- items: FAQItem[];
15
- }
11
+ export type { FAQItem };
12
+ export type Props = FAQGraphOptions;
16
13
 
17
- const { items } = Astro.props;
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
- export interface Props {
3
- name: string;
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
- const {
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)} />