@se-studio/skills 1.1.0 → 1.1.1
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 +26 -0
- package/package.json +1 -1
- package/skills/se-marketing-sites-redirects/SKILL.md +17 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @se-studio/skills
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Simplify Redirect content model + add tagType as a first-class internal link target.
|
|
8
|
+
|
|
9
|
+
The original redirect content type (added in the previous minor) used a verbose Contentful model with separate `fromPage`/`fromArticle`/etc. reference fields (and same for "to"). This has been replaced with the clean model:
|
|
10
|
+
|
|
11
|
+
- `fromPath` (raw/custom) + `fromInternal` (single Link→Entry)
|
|
12
|
+
- `toPath` (raw/external) + `toInternal` (single Link→Entry)
|
|
13
|
+
|
|
14
|
+
Both internal fields are restricted via `linkContentType` validation to: page, article, articleType, person, tag, customType, tagType.
|
|
15
|
+
|
|
16
|
+
Updated:
|
|
17
|
+
|
|
18
|
+
- Migration `scripts/migrations/18-create-redirect-content-type.js` (now a clean create for the good model; delete any previous "Redirect" CT first if you ran the old multi-field version).
|
|
19
|
+
- `BaseRedirectSkeleton`, `baseRedirectConverter`, and `IRedirect` (provenance is now `fromInternal`/`toInternal` as `IInternalLink`).
|
|
20
|
+
- `UrlCalculators` now requires a `tagType(slug)` function (to support selecting tag type indexes as redirect targets).
|
|
21
|
+
- Added `baseTagTypeLinkConverter`, registered the resolver, extended `BaseLink` / `InternalType` / exported `ITagTypeLink` + guard.
|
|
22
|
+
|
|
23
|
+
Docs and the `se-marketing-sites-redirects` skill have been updated with the new CT shape, help text guidance, and testing steps.
|
|
24
|
+
|
|
25
|
+
Consumers will need to implement `tagType` in their urlCalculators (and pass it through `createBaseConverterContext`) to select Tag Type entries in redirects and to satisfy the updated type.
|
|
26
|
+
|
|
27
|
+
The runtime redirect map, middleware, and `buildRedirectMap` behaviour are unchanged.
|
|
28
|
+
|
|
3
29
|
## 1.1.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: se-marketing-sites-redirects
|
|
3
|
-
description: "Add support for editor-managed URL redirects using a dedicated redirect content type + the proven A/B-style rebuild pattern (webhook to Vercel deploy hook, build bakes a static map). Includes the
|
|
3
|
+
description: "Add support for editor-managed URL redirects using a dedicated redirect content type + the proven A/B-style rebuild pattern (webhook to Vercel deploy hook, build bakes a static map). Includes the official migration script (create the clean CT with fromInternal/toInternal single-ref pickers)."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# SE Marketing Sites — Redirects (rebuild pattern)
|
|
@@ -8,7 +8,7 @@ description: "Add support for editor-managed URL redirects using a dedicated red
|
|
|
8
8
|
This skill adds the ability for **non-technical content editors** to manage redirects entirely from Contentful.
|
|
9
9
|
|
|
10
10
|
**Core idea (matches how your A/B tests already work):**
|
|
11
|
-
- Editors create `redirect` entries (they can **pick** existing Pages/Articles/etc.
|
|
11
|
+
- Editors create `redirect` entries (they can **pick** existing Pages/Articles/etc. via the single From/To internal pickers or type raw paths).
|
|
12
12
|
- On publish, a Contentful webhook calls your Vercel **Deploy Hook**.
|
|
13
13
|
- The next build fetches the current redirects (via the normal CDA helpers), runs `buildRedirectMap`, and writes a tiny static file.
|
|
14
14
|
- Your `middleware.ts` imports that file and does the redirect **synchronously with zero runtime cost**.
|
|
@@ -16,33 +16,32 @@ This skill adds the ability for **non-technical content editors** to manage redi
|
|
|
16
16
|
|
|
17
17
|
A faster "seconds" path (Edge Config) is explicitly **not** included in v1 per product direction — the model and helpers are forward-compatible if you add it later.
|
|
18
18
|
|
|
19
|
-
## 1. Run the
|
|
19
|
+
## 1. Run the migration (create the content type)
|
|
20
20
|
|
|
21
|
-
The repo contains
|
|
21
|
+
The repo contains the official migration:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
#
|
|
24
|
+
# Create the redirect content type (clean fromPath + fromInternal / toPath + toInternal model)
|
|
25
25
|
node scripts/migrations/18-create-redirect-content-type.js
|
|
26
|
-
|
|
27
|
-
# 2. (Later, when you are ready) Remove the old per-page redirectTo fields
|
|
28
|
-
node scripts/migrations/19-remove-redirectTo-fields.js
|
|
29
26
|
```
|
|
30
27
|
|
|
31
|
-
Run
|
|
28
|
+
Run it with the Contentful CLI (or the contentful-cms package tools) and the usual `CONTENTFUL_SPACE_ID` + `CONTENTFUL_MANAGEMENT_TOKEN` + environment.
|
|
29
|
+
|
|
30
|
+
If you previously created a Redirect CT using an older multi-field version of the migration, **delete the "Redirect" content type first**, then re-run to get the clean single-ref model.
|
|
32
31
|
|
|
33
|
-
After
|
|
32
|
+
After running you will have a new (or repaired) content type called **Redirect**.
|
|
34
33
|
|
|
35
34
|
## 2. The Redirect content type (what editors see)
|
|
36
35
|
|
|
37
36
|
Key fields (all documented with help text in the migration):
|
|
38
37
|
|
|
39
38
|
**From (source)**
|
|
40
|
-
- `fromPath` (raw path) — editors type `/old-url/` when they are not using
|
|
41
|
-
- `
|
|
39
|
+
- `fromPath` (raw path) — editors type `/old-url/` when they are not using the picker.
|
|
40
|
+
- `fromInternal` (single reference picker) — restricted to page, article, articleType, person, tag, customType, tagType. When an editor picks one, the system automatically uses that item's current URL. This is the magic that makes it easy for non-technical people.
|
|
42
41
|
|
|
43
42
|
**To (destination)**
|
|
44
43
|
- `toPath` (raw path or full external `https://...` URL)
|
|
45
|
-
- `
|
|
44
|
+
- `toInternal` (single reference picker, same allowed types as fromInternal)
|
|
46
45
|
|
|
47
46
|
**Other**
|
|
48
47
|
- `statusCode` — dropdown: 301 (permanent — recommended), 302, 307, 308.
|
|
@@ -51,7 +50,7 @@ Key fields (all documented with help text in the migration):
|
|
|
51
50
|
- `cmsLabel` — required internal label.
|
|
52
51
|
|
|
53
52
|
**Editor guidance (the help text says this):**
|
|
54
|
-
> For redirects
|
|
53
|
+
> For redirects from existing CMS content, use the "From internal" / "To internal" picker instead of typing the slug. Only use the raw path fields for old/vanity URLs that no longer exist in the CMS or for external sites.
|
|
55
54
|
|
|
56
55
|
The converter (`baseRedirectConverter`) resolves any chosen references into concrete `fromPath` / `to` strings at fetch time. The baked map only ever contains simple strings.
|
|
57
56
|
|
|
@@ -59,7 +58,7 @@ The converter (`baseRedirectConverter`) resolves any chosen references into conc
|
|
|
59
58
|
|
|
60
59
|
The following are already in the packages:
|
|
61
60
|
|
|
62
|
-
- `IRedirect` + `isRedirect` in `@se-studio/core-data-types`
|
|
61
|
+
- `IRedirect` + `isRedirect` in `@se-studio/core-data-types` (now uses `fromInternal` / `toInternal`)
|
|
63
62
|
- `baseRedirectConverter` + `BaseRedirectSkeleton`
|
|
64
63
|
- `contentfulRedirectsRest` + `buildRedirectMap` + `getRedirectsWithErrors` / `getRedirectMap` (via `createAppHelpers`)
|
|
65
64
|
- Revalidation tag `redirect` (so the existing webhook machinery knows about the new type)
|
|
@@ -191,15 +190,15 @@ That's it. Publish a redirect → Vercel starts a build → the generate step ru
|
|
|
191
190
|
|
|
192
191
|
1. Run the create migration.
|
|
193
192
|
2. In Contentful create a Redirect:
|
|
194
|
-
- Pick a real Page
|
|
195
|
-
-
|
|
193
|
+
- Pick a real Page via the single "From internal" picker.
|
|
194
|
+
- Pick (or type) a destination via "To internal" or "To path".
|
|
196
195
|
- Status 301, Active on.
|
|
197
196
|
3. Publish.
|
|
198
197
|
4. Watch the deploy hook fire a build in Vercel.
|
|
199
198
|
5. After the build finishes: `curl -I https://your-site/from-page-url/` → 301 to the target.
|
|
200
199
|
6. Also test a raw-path rule and an external URL.
|
|
201
200
|
7. Edit the rule → republish → new build → new behaviour.
|
|
202
|
-
8. (Optional)
|
|
201
|
+
8. (Optional) If you also want to clean up legacy per-page `redirectTo` fields, run migration 19.
|
|
203
202
|
|
|
204
203
|
## 6. Preview / draft deployments
|
|
205
204
|
|