@yysng/astro-boilerplate 1.1.9 → 1.1.10

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.9",
3
+ "version": "1.1.10",
4
4
  "description": "Astro + Sanity Boilerplate with AEO Layers 1–5",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,23 +1,17 @@
1
1
  // src/content-system/loader.js
2
2
 
3
- import hero from "../content/hero.json";
4
- import cta from "../content/cta.json";
5
- import about from "../content/about.json";
6
- import testimonials from "../content/testimonials.json";
7
-
8
- const CONTENT_CACHE = {
9
- hero,
10
- cta,
11
- about,
12
- testimonials
13
- };
3
+ const contentModules = import.meta.glob(
4
+ '/src/content/*.json',
5
+ { eager: true }
6
+ );
14
7
 
15
8
  export function loadContent(key) {
16
- const data = CONTENT_CACHE[key];
9
+ const path = `/src/content/${key}.json`;
10
+ const mod = contentModules[path];
17
11
 
18
- if (!data) {
19
- throw new Error(`Unknown content key: ${key}`);
12
+ if (!mod || !mod.default) {
13
+ throw new Error(`Content not found: ${path}`);
20
14
  }
21
15
 
22
- return data;
16
+ return mod.default;
23
17
  }