@m13v/seo-components 0.8.7 → 0.8.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": "@m13v/seo-components",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "scripts": {
5
5
  "build:css": "tailwind -i src/_build.css -o dist/styles.css --minify",
6
6
  "prepublishOnly": "npm run build:css"
@@ -19,7 +19,7 @@ function slugify(text: string): string {
19
19
  * This keeps the sidebar ToC clickable without requiring every page
20
20
  * author to add id attributes manually.
21
21
  */
22
- export function HeadingAnchors() {
22
+ export function HeadingAnchors({ children }: { children?: React.ReactNode } = {}) {
23
23
  const pathname = usePathname();
24
24
 
25
25
  useEffect(() => {
@@ -55,5 +55,5 @@ export function HeadingAnchors() {
55
55
  }
56
56
  }, [pathname]);
57
57
 
58
- return null;
58
+ return children ? <>{children}</> : null;
59
59
  }
@@ -25,9 +25,15 @@ export function discoverGuides(contentDir?: string): GuideEntry[] {
25
25
 
26
26
  if (cachedDir === dir && cachedGuides) return cachedGuides;
27
27
 
28
- // Determine which URL prefix these pages live under by
29
- // finding the path segments after src/app (skipping route groups).
30
- const appDir = path.join(process.cwd(), "src/app");
28
+ // Determine the Next.js app directory root from contentDir.
29
+ // e.g. "src/app/t" -> "src/app", "app" -> "app", "src/app/(content)/t" -> "src/app"
30
+ const relDir = path.relative(process.cwd(), dir);
31
+ const relParts = relDir.split(path.sep);
32
+ const appIdx = relParts.indexOf("app");
33
+ const appDir =
34
+ appIdx >= 0
35
+ ? path.join(process.cwd(), ...relParts.slice(0, appIdx + 1))
36
+ : path.join(process.cwd(), "src/app");
31
37
  const allPages = walkPages({ appDir });
32
38
 
33
39
  // Figure out the href prefix from contentDir.