@thg-altitude/schemaorg 1.0.6 → 1.0.7

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": "@thg-altitude/schemaorg",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,15 +2,15 @@
2
2
  let url = import.meta.env.DEV
3
3
  ? Astro.url.origin
4
4
  : `${Astro.request.headers.get(
5
- 'X-forwarded-Proto'
6
- )}://${Astro.request.headers.get('X-forwarded-Host')}`
5
+ 'X-Forwarded-Proto'
6
+ )}://${Astro.request.headers.get('X-Forwarded-Host')}`
7
7
  let itemListElement = []
8
8
  Astro.props.breadcrumbs.forEach((item,index) => {
9
9
  itemListElement.push({
10
- "type": "ListItem",
10
+ "@type": "ListItem",
11
11
  "position": index + 1,
12
12
  "item" : {
13
- "@type" : "Thing",
13
+ "@type": "Thing",
14
14
  "@id" : item.pagePath.includes("p/") || item.displayName === "Home" ? `${url}${item?.pagePath}` : `${url}/c${item?.pagePath}`,
15
15
  "name" : item?.displayName
16
16
  }
@@ -2,8 +2,8 @@
2
2
  let url = import.meta.env.DEV
3
3
  ? Astro.url.origin
4
4
  : `${Astro.request.headers.get(
5
- 'X-forward-Proto'
6
- )}://${Astro.request.headers.get('X-forward-Host')}`
5
+ 'X-forwarded-Proto'
6
+ )}://${Astro.request.headers.get('X-forwarded-Host')}`
7
7
  let offersArray = []
8
8
  Astro.props.variants.forEach((variant)=>{
9
9
  offersArray.push({
@@ -24,7 +24,7 @@ let schema = {
24
24
  "sku": Astro.props.sku,
25
25
  "name": Astro.props.name,
26
26
  "description": Astro.props.description,
27
- "image": `https://img.cf-thgaltitude.com/?url=${Astro.props.image}`,
27
+ "image": `${import.meta.env.IMAGE_PROXY_URL}?url=${Astro.props.image}`,
28
28
  "brand": {
29
29
  "@type": "Brand",
30
30
  "name": Astro.props.brand,
@@ -0,0 +1,41 @@
1
+ ---
2
+ let url = import.meta.env.DEV
3
+ ? Astro.url.origin
4
+ : `${Astro.request.headers.get(
5
+ 'X-Forwarded-Proto'
6
+ )}://${Astro.request.headers.get('X-Forwarded-Host')}`
7
+ let itemListElement = []
8
+ Astro.props.list.forEach((product,index) => {
9
+ itemListElement.push({
10
+ "type": "ListItem",
11
+ "position": index + 1,
12
+ "item" : {
13
+ "@type" : "Product",
14
+ "name" : product?.title,
15
+ "url": `${url}${product.url}`,
16
+ "sku": product.sku,
17
+ "image":`${import.meta.env.IMAGE_PROXY_URL}?url=${product.images[0].original}`,
18
+ "offers":{
19
+ "@type":"Offer",
20
+ "availability": "https://schema.org/InStock",
21
+ "price":product.defaultVariant ? product.defaultVariant.price.price.amount : product.cheapestVariant.price.price.amount,
22
+ "priceCurrency": Astro.props.currency
23
+
24
+ }
25
+ }
26
+ })
27
+
28
+ });
29
+
30
+ let schema = {
31
+ "@type":"ProductCollection",
32
+ "@context": "https://schema.org",
33
+ "mainEntity":{
34
+ "@type":"ItemList",
35
+ "itemListElement": itemListElement,
36
+ }
37
+ };
38
+
39
+ ---
40
+
41
+ <script type="application/ld+json" set:html={JSON.stringify(schema)}></script>
@@ -2,8 +2,8 @@
2
2
  let url = import.meta.env.DEV
3
3
  ? Astro.url.origin
4
4
  : `${Astro.request.headers.get(
5
- 'X-forward-Proto'
6
- )}://${Astro.request.headers.get('X-forward-Host')}`
5
+ 'X-Forwarded-Proto'
6
+ )}://${Astro.request.headers.get('X-Forwarded-Host')}`
7
7
  let itemListElement = []
8
8
  Astro.props.list.forEach((product,index) => {
9
9
  itemListElement.push({
@@ -14,15 +14,17 @@ Astro.props.list.forEach((product,index) => {
14
14
  "name" : product?.title,
15
15
  "url": `${url}${product.url}`,
16
16
  "sku": product.sku,
17
- "image":`https://img.cf-thgaltitude.com/?url=${product.images[0].largeProduct}`,
17
+ "image":`${import.meta.env.IMAGE_PROXY_URL}?url=${product.images[0].original}`,
18
18
  "offers":{
19
19
  "@type":"Offer",
20
20
  "availability": "https://schema.org/InStock",
21
21
  "price":product.defaultVariant ? product.defaultVariant.price.price.amount : product.cheapestVariant.price.price.amount,
22
22
  "priceCurrency": Astro.props.currency
23
+
23
24
  }
24
25
  }
25
26
  })
27
+
26
28
  });
27
29
 
28
30
  let schema = {