@se-studio/skills 1.8.1 → 1.8.2
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -138,7 +138,7 @@ If the slug is not a known variant in `testsByPath`, **return 404** (`notFound()
|
|
|
138
138
|
Direct visits to a variant's own CMS URL (normal `[...slugs]` route) continue to use `generatePage` and show variant breadcrumbs.
|
|
139
139
|
|
|
140
140
|
```typescript
|
|
141
|
-
import { findCanonicalPath } from '@se-studio/ab-testing';
|
|
141
|
+
import { controlSlugFromCanonicalPath, findCanonicalPath } from '@se-studio/ab-testing';
|
|
142
142
|
import { joinCmsPathSegments } from '@se-studio/core-ui';
|
|
143
143
|
import type { ResolvingMetadata } from 'next';
|
|
144
144
|
import { notFound } from 'next/navigation';
|
|
@@ -174,7 +174,10 @@ export async function generateMetadata(
|
|
|
174
174
|
) {
|
|
175
175
|
const { slug } = await extractDetails(props);
|
|
176
176
|
const canonicalPath = requireCanonicalPath(slug);
|
|
177
|
-
|
|
177
|
+
// `/` → CMS slug `index`. Never `replace(...) || slug` — that uses the variant
|
|
178
|
+
// (indexed: false) and flip-flops robots on the homepage. generatePageTest*
|
|
179
|
+
// also re-resolves so a stale `|| slug` cannot noindex `/`.
|
|
180
|
+
const canonicalSlug = controlSlugFromCanonicalPath(canonicalPath);
|
|
178
181
|
// Use generatePageTestMetadata: merges variant title/description with
|
|
179
182
|
// canonical page's indexed flag so robots directives are always correct.
|
|
180
183
|
return generatePageTestMetadata(slug, canonicalSlug, canonicalPath, getPageRouteConfig(canonicalSlug), parent);
|
|
@@ -183,12 +186,14 @@ export async function generateMetadata(
|
|
|
183
186
|
export default async function (props: PageProps<'/page-test/[...slugs]'>) {
|
|
184
187
|
const { slug } = await extractDetails(props);
|
|
185
188
|
const canonicalPath = requireCanonicalPath(slug);
|
|
186
|
-
const canonicalSlug = canonicalPath
|
|
189
|
+
const canonicalSlug = controlSlugFromCanonicalPath(canonicalPath);
|
|
187
190
|
// Use generatePageTest: variant contents with control identity (href, breadcrumbs, JSON-LD).
|
|
188
191
|
return generatePageTest(slug, canonicalSlug, canonicalPath, getPageRouteConfig(canonicalSlug));
|
|
189
192
|
}
|
|
190
193
|
```
|
|
191
194
|
|
|
195
|
+
If the site homepage CMS slug is not `index` (e.g. Pedestal `home`), pass it: `controlSlugFromCanonicalPath(canonicalPath, 'home')`.
|
|
196
|
+
|
|
192
197
|
Also export `generatePageTestMetadata` and `generatePageTest` from the app's `src/lib/route-handlers.ts` destructuring alongside `generatePageMetadata`.
|
|
193
198
|
|
|
194
199
|
## See Also
|