@m13v/seo-components 0.8.10 → 0.8.11
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 +1 -1
- package/src/lib/discover-guides.ts +15 -8
- package/src/next.js +6 -6
package/package.json
CHANGED
|
@@ -28,16 +28,23 @@ export function discoverGuides(contentDir?: string): GuideEntry[] {
|
|
|
28
28
|
|
|
29
29
|
// Try to load the build-time manifest first (generated by withSeoContent).
|
|
30
30
|
// This is required on Vercel where fs.readdirSync can't walk source dirs.
|
|
31
|
-
|
|
31
|
+
// Check both project root and .next/ for backwards compat.
|
|
32
|
+
const candidates = [
|
|
33
|
+
path.join(process.cwd(), "seo-guides-manifest.json"),
|
|
34
|
+
path.join(process.cwd(), ".next", "seo-guides-manifest.json"),
|
|
35
|
+
];
|
|
32
36
|
let manifestPages: PageEntry[] | null = null;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
for (const manifestPath of candidates) {
|
|
38
|
+
try {
|
|
39
|
+
const raw = fs.readFileSync(manifestPath, "utf-8");
|
|
40
|
+
const manifest = JSON.parse(raw);
|
|
41
|
+
if (Array.isArray(manifest.pages)) {
|
|
42
|
+
manifestPages = manifest.pages;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
} catch {
|
|
46
|
+
// Try next candidate
|
|
38
47
|
}
|
|
39
|
-
} catch {
|
|
40
|
-
// No manifest; fall back to filesystem walking
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
let guides: GuideEntry[];
|
package/src/next.js
CHANGED
|
@@ -29,12 +29,12 @@ export function withSeoContent(config = {}, opts = {}) {
|
|
|
29
29
|
const contentGlob = `./${contentDir}/**/*`;
|
|
30
30
|
const existing = config.outputFileTracingIncludes ?? {};
|
|
31
31
|
|
|
32
|
-
// Build a manifest at config evaluation time (runs during `next build`)
|
|
32
|
+
// Build a manifest at config evaluation time (runs during `next build`).
|
|
33
|
+
// Write to project root so outputFileTracingIncludes can find it reliably.
|
|
34
|
+
const manifestFile = "seo-guides-manifest.json";
|
|
33
35
|
try {
|
|
34
36
|
const manifest = buildManifest(contentDir);
|
|
35
|
-
|
|
36
|
-
const manifestPath = join(process.cwd(), ".next", "seo-guides-manifest.json");
|
|
37
|
-
writeFileSync(manifestPath, JSON.stringify(manifest));
|
|
37
|
+
writeFileSync(join(process.cwd(), manifestFile), JSON.stringify(manifest));
|
|
38
38
|
} catch (e) {
|
|
39
39
|
// Non-fatal: the runtime will fall back to filesystem walking
|
|
40
40
|
}
|
|
@@ -43,8 +43,8 @@ export function withSeoContent(config = {}, opts = {}) {
|
|
|
43
43
|
...config,
|
|
44
44
|
outputFileTracingIncludes: {
|
|
45
45
|
...existing,
|
|
46
|
-
"/api/guide-chat": [contentGlob,
|
|
47
|
-
"/api/guide-chat/route": [contentGlob,
|
|
46
|
+
"/api/guide-chat": [contentGlob, `./${manifestFile}`],
|
|
47
|
+
"/api/guide-chat/route": [contentGlob, `./${manifestFile}`],
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
50
|
}
|