@m13v/seo-components 0.8.8 → 0.8.9

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": "@m13v/seo-components",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "scripts": {
5
5
  "build:css": "tailwind -i src/_build.css -o dist/styles.css --minify",
6
6
  "prepublishOnly": "npm run build:css"
@@ -40,8 +40,10 @@ export function discoverGuides(contentDir?: string): GuideEntry[] {
40
40
  // e.g. "src/app/(content)/t" -> "/t", "src/app/t" -> "/t"
41
41
  const relative = path.relative(appDir, dir);
42
42
  const segments = relative
43
- .split(path.sep)
44
- .filter((s) => !s.startsWith("(") || !s.endsWith(")"));
43
+ ? relative
44
+ .split(path.sep)
45
+ .filter((s) => !(s.startsWith("(") && s.endsWith(")")))
46
+ : [];
45
47
  const hrefPrefix = "/" + segments.join("/");
46
48
 
47
49
  const guides: GuideEntry[] = allPages
@@ -19,7 +19,15 @@ export function getGuideContext(
19
19
  const guide = discoverGuides(dir).find((g) => g.slug === slug);
20
20
  if (!guide) return null;
21
21
 
22
- const pagePath = path.join(dir, slug, "page.tsx");
22
+ // Derive appDir from contentDir to locate page files by their full href
23
+ const relDir = path.relative(process.cwd(), dir);
24
+ const relParts = relDir.split(path.sep);
25
+ const appIdx = relParts.indexOf("app");
26
+ const appDir =
27
+ appIdx >= 0
28
+ ? path.join(process.cwd(), ...relParts.slice(0, appIdx + 1))
29
+ : dir;
30
+ const pagePath = path.join(appDir, guide.href, "page.tsx");
23
31
  let rawSource = "";
24
32
  try {
25
33
  rawSource = fs.readFileSync(pagePath, "utf-8");