@thg-altitude/schemaorg 1.0.42 → 1.0.43

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/index.js CHANGED
@@ -1,23 +1,25 @@
1
- import Product from './src/components/Product.astro'
2
- import EnhancedProduct from './src/components/EnhancedProduct.astro'
1
+ import Article from './src/components/Article.astro'
3
2
  import Breadcrumb from './src/components/Breadcrumb.astro'
4
3
  import CollectionPage from './src/components/CollectionPage.astro'
4
+ import EnhancedProduct from './src/components/EnhancedProduct.astro'
5
+ import EnhancedProductList from './src/components/EnhancedProductList.astro'
6
+ import FAQ from './src/components/FAQ.astro'
5
7
  import Organization from './src/components/Organization.astro'
8
+ import Product from './src/components/Product.astro'
6
9
  import ProductCollection from './src/components/ProductCollection.astro'
7
- import WebSite from './src/components/WebSite.astro'
8
- import EnhancedProductList from './src/components/EnhancedProductList.astro'
9
10
  import Recipe from './src/components/Recipe.astro'
10
- import FAQ from './src/components/FAQ.astro'
11
+ import WebSite from './src/components/WebSite.astro'
11
12
 
12
13
  export {
13
- Product,
14
- EnhancedProduct,
14
+ Article,
15
15
  Breadcrumb,
16
16
  CollectionPage,
17
+ EnhancedProduct,
18
+ EnhancedProductList,
19
+ FAQ,
17
20
  Organization,
21
+ Product,
18
22
  ProductCollection,
23
+ Recipe,
19
24
  WebSite,
20
- EnhancedProductList,
21
- FAQ,
22
- Recipe
23
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thg-altitude/schemaorg",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,59 @@
1
+ ---
2
+ interface Props {
3
+ article: {
4
+ canonical_url: string;
5
+ title: string;
6
+ excerpt_or_meta_description: string;
7
+ featured_image_url: string;
8
+ publish_date: string;
9
+ last_modified_date: string;
10
+ },
11
+ author: {
12
+ name: string;
13
+ profile_url: string;
14
+ profile_image_url: string;
15
+ },
16
+ publisher?: {
17
+ name: string;
18
+ logo: string;
19
+ },
20
+ }
21
+ const { article, author , publisher} = Astro.props as Props;
22
+
23
+ const schema = {
24
+ "@context": "https://schema.org",
25
+ "@type": "Article",
26
+ "mainEntityOfPage": {
27
+ "@type": "WebPage",
28
+ "@id": article.canonical_url
29
+ },
30
+ "headline": article.title,
31
+ "description": article.excerpt_or_meta_description,
32
+ "image": article.featured_image_url,
33
+ "datePublished": article.publish_date,
34
+ "dateModified": article.last_modified_date,
35
+ "author": {
36
+ "@type": "Person",
37
+ "name": author.name,
38
+ "url": author.profile_url,
39
+ "image": {
40
+ "@type": "ImageObject",
41
+ "url": author.profile_image_url
42
+ }
43
+ },
44
+ }
45
+
46
+ if (publisher) {
47
+ schema["publisher"] = {
48
+ "@type": "Organization",
49
+ "name": publisher.name,
50
+ "logo": {
51
+ "@type": "ImageObject",
52
+ "url": publisher.logo
53
+ }
54
+ };
55
+ }
56
+
57
+ ---
58
+
59
+ <script type="application/ld+json" set:html={JSON.stringify(schema)}></script>
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  interface Props {
3
- faqs: { title: string; body: string }[];
3
+ faqs: { question: string; answer: string }[];
4
4
  }
5
5
 
6
6
  interface faqQA {
@@ -15,13 +15,13 @@ interface faqQA {
15
15
  const { faqs } = Astro.props as Props;
16
16
 
17
17
  const validFaqs = faqs.reduce((acc, faq) => {
18
- if (faq?.title && faq?.body) {
18
+ if (faq?.question && faq?.answer) {
19
19
  acc.push({
20
20
  "@type": "Question",
21
- name: faq.title,
21
+ name: faq.question,
22
22
  acceptedAnswer: {
23
23
  "@type": "Answer",
24
- text: faq.body,
24
+ text: faq.answer,
25
25
  },
26
26
  });
27
27
  }