@yysng/astro-boilerplate 1.1.6 → 1.1.8

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": "@yysng/astro-boilerplate",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Astro + Sanity Boilerplate with AEO Layers 1–5",
5
5
  "type": "module",
6
6
  "exports": {
@@ -184,13 +184,16 @@ graph = graph.filter((item, idx, arr) => {
184
184
  )}
185
185
 
186
186
  {gtmId && (
187
- <script>
188
- {`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
187
+ <script
188
+ is:inline
189
+ set:html={`
190
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
189
191
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
190
192
  j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
191
193
  'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
192
- })(window,document,'script','dataLayer','${gtmId}');`}
193
- </script>
194
- )}
194
+ })(window,document,'script','dataLayer','${gtmId}');
195
+ `}
196
+ />
197
+ )}
195
198
 
196
199
  </head>
@@ -1,6 +1,7 @@
1
1
  export const schemas = {
2
2
  hero: {
3
3
  required: ["title", "subtitle"],
4
+ // CTA remains optional by validation logic
4
5
  validate(data) {
5
6
  if (typeof data.title !== "string") {
6
7
  throw new Error("Hero.title must be a string");
@@ -24,5 +25,30 @@ export const schemas = {
24
25
  }
25
26
  }
26
27
  }
28
+ },
29
+
30
+ cta: {
31
+ required: ["heading", "button"],
32
+ validate(data) {
33
+ if (typeof data.heading !== "string") {
34
+ throw new Error("CTA.heading must be a string");
35
+ }
36
+
37
+ if (data.description && typeof data.description !== "string") {
38
+ throw new Error("CTA.description must be a string");
39
+ }
40
+
41
+ if (!data.button || typeof data.button !== "object") {
42
+ throw new Error("CTA.button must be an object");
43
+ }
44
+
45
+ if (typeof data.button.label !== "string") {
46
+ throw new Error("CTA.button.label must be a string");
47
+ }
48
+
49
+ if (typeof data.button.href !== "string") {
50
+ throw new Error("CTA.button.href must be a string");
51
+ }
27
52
  }
53
+ },
28
54
  };