fix(plugins): 301 bare element slugs on versioned plugin URLs
- Dominant language
- Astro
- Stars
- 155
- Forks
- 177
- Avg merge
- 1d 20m
- Merged PRs (30d)
- 192
Description
Follow-up to #5680.
`/plugins////` (e.g. `/plugins/plugin-ai/v1.16.0/tool/stdiomcpclient`) is not a page either: element pages end with the fully qualified class name. The router still renders the subgroup page there, indexable and self-canonical, with every element card linking to `/plugins/plugin-ai/v1.16.0/tool/stdiomcpclient/`, which 301s.
```
GET https://kestra.io/plugins/plugin-ai/v1.16.0/tool/stdiomcpclient
→ 200
→
→
→ 12 links of shape /plugins/plugin-ai/v1.16.0/tool/stdiomcpclient/
```
#5680 fixed the unversioned shape only: the `if (!versionState.version)` guard in the router deliberately skips versioned URLs, because `pageList` holds unversioned paths and reusing `resolveShortElementSlug` as-is would 301 to a target with the version segment dropped.
The same duplicate therefore remains on every released version of every plugin, which multiplies the number of duplicate pages and redirected outlinks by the number of versions.
**Expected**
- `/plugins////` 301s to `/plugins////` when the bare name matches an element of that plugin (subgroup first, then the rest of the plugin, same order as the unversioned resolver), and to `/plugins///` otherwise.
- Known versioned pages are left untouched.
**Notes**
- The fix needs the version segment re-inserted into the redirect target rather than a plain reuse of the unversioned resolver.
- Unit tests should cover the same three cases as `src/utils/plugins/shortElementSlug.test.ts`, plus the version segment.
Contributor guide
Assessment
This issue has not been assessed yet.