elastic / elastic/docs-builder
Cross-repo link to a redirected page renders a malformed URL (keeps source path prefix)
- Dominant language
- C#
- Stars
- 24
- Forks
- 44
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 146
Description
## Summary
When a cross-repo link (`docs-content://…`) points at a page that has been moved and now resolves via a `redirects.yml` entry, docs-builder follows the redirect but renders a **malformed URL**: it grafts the redirect *target* onto the *source* path's leading segment, producing a 404.
## Evidence
Live broken link on the OpenAI connector reference page (rendered `href`):
```
https://www.elastic.co/docs/solutions/explore-analyze/ai-features/llm-guides/connect-to-lmstudio-security ← 404
```
The three relevant paths:
| | Path |
|---|---|
| Source link (Kibana) | `docs-content://solutions/security/ai/connect-to-own-local-llm.md` |
| `redirects.yml` target | `explore-analyze/ai-features/llm-guides/connect-to-lmstudio-security.md` |
| **Rendered href** | `/docs/`**`solutions/`**`explore-analyze/ai-features/llm-guides/connect-to-lmstudio-security` |
The redirect *is* applied (target filename `connect-to-lmstudio-security` is correct), but the leading `solutions/` segment from the source path is wrongly prepended. Correct URL: `/docs/explore-analyze/ai-features/llm-guides/connect-to-lmstudio-security`.
References:
- Source link: https://github.com/elastic/kibana/blob/64444f49ec11c7982dc2f60edf5575a5bc2f6fc8/docs/reference/connectors-kibana/openai-action-type.md?plain=1#L156
- Redirect entry: https://github.com/elastic/docs-content/blob/4cba09d032c0b61aa75bbd809f6c9a4f39413cde/redirects.yml#L627
## Expected
A cross-repo link to a redirected page resolves to the redirect target's actual URL (`/docs/explore-analyze/ai-features/llm-guides/connect-to-lmstudio-security`), with no leftover prefix from the source path.
## Actual
The redirect target is grafted onto the source path's first segment (`solutions/`), yielding a 404.
## Workaround
Point the source link directly at the current file path so no redirect resolution is involved (but that defeats the purpose of being able to rely on redirects)
Contributor guide
Research direction
Start with the linked Kibana source in openai-action-type.md and the corresponding redirects.yml entry, then trace docs-builder's cross-repo redirect URL resolution. Reproduce the malformed href and add coverage for a redirected cross-repo link; done means the rendered URL uses the redirect target without the source path prefix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 64/100