@m13v/seo-components 0.8.12 → 0.8.13

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.12",
3
+ "version": "0.8.13",
4
4
  "scripts": {
5
5
  "build:css": "tailwind -i src/_build.css -o dist/styles.css --minify",
6
6
  "prepublishOnly": "npm run build:css"
@@ -42,7 +42,9 @@ function onPosthogLoaded(fn: () => void) {
42
42
  /** Derive a slug from any pathname. "/" returns "" (hidden). */
43
43
  function slugFromPath(pathname: string | null): string {
44
44
  if (!pathname || pathname === "/") return "";
45
- return pathname.replace(/^\/+/, "").replace(/\/+$/g, "").replace(/\//g, "-");
45
+ // Return cleaned pathname (e.g. "/solutions/sap" -> "solutions/sap")
46
+ // The server matches by href or last-segment slug.
47
+ return pathname.replace(/^\/+/, "").replace(/\/+$/g, "");
46
48
  }
47
49
 
48
50
  /* ------------------------------------------------------------------ */
@@ -16,7 +16,12 @@ export function getGuideContext(
16
16
  contentDir?: string,
17
17
  ): GuideContext | null {
18
18
  const dir = contentDir ?? path.join(process.cwd(), "src/app/(content)/t");
19
- const guide = discoverGuides(dir).find((g) => g.slug === slug);
19
+ const guides = discoverGuides(dir);
20
+ // Match by last-segment slug or full href path (e.g. "solutions/sap" -> "/solutions/sap")
21
+ const hrefFromSlug = "/" + slug;
22
+ const guide = guides.find(
23
+ (g) => g.slug === slug || g.href === hrefFromSlug,
24
+ );
20
25
  if (!guide) return null;
21
26
 
22
27
  // Derive appDir from contentDir to locate page files by their full href