Skip to content

Commit 21fd0c0

Browse files
authored
Fix relative links in docs (CopilotKit#2506)
1 parent 8c9945e commit 21fd0c0

10 files changed

Lines changed: 25 additions & 15 deletions

File tree

docs/components/react/subdocs-menu.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,23 @@ export function NavigationLink({
165165
const normalizeHref = (input: string): string => {
166166
if (!input || typeof input !== 'string') return input;
167167
if (!input.startsWith('/')) return input; // already relative or external
168-
const currentTop = (pathname.split('/')[1] || '').trim();
169-
const targetTop = (input.split('/')[1] || '').trim();
170-
if (currentTop && targetTop && currentTop === targetTop) {
171-
const rest = input.split('/').slice(2).join('/');
172-
return rest ? `./${rest}` : './';
168+
169+
const currentSplit = pathname.split('/').filter(x => x);
170+
const targetSplit = input.split('/').filter(x => x);
171+
while (currentSplit.length > 1 && targetSplit.length > 1 && currentSplit[0] === targetSplit[0]) {
172+
currentSplit.shift();
173+
targetSplit.shift();
174+
}
175+
176+
let rel = '';
177+
for (let i = 0; i < currentSplit.length - 1; i++) {
178+
rel += '../';
179+
}
180+
if (rel === '') {
181+
rel = './';
173182
}
174-
return input;
183+
rel += targetSplit.join('/');
184+
return rel;
175185
};
176186

177187
const renderedHref = normalizeHref(href);

docs/content/docs/adk/shared-state/in-app-agent-read.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ state update you can reflect these updates natively in your application.
3232
### Run and Connect Your Agent to CopilotKit
3333

3434
You'll need to run your agent and connect it to CopilotKit before proceeding. If you haven't done so already,
35-
you can follow the instructions in the [Getting Started](/getting-started) guide.
35+
you can follow the instructions in the [Getting Started](/adk/quickstart) guide.
3636

3737
</Step>
3838
<Step>

docs/content/docs/adk/shared-state/in-app-agent-write.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ when your agent is calling tools. CopilotKit allows you to fully customize how t
3333
### Run and Connect Your Agent to CopilotKit
3434

3535
You'll need to run your agent and connect it to CopilotKit before proceeding. If you haven't done so already,
36-
you can follow the instructions in the [Getting Started](/getting-started) guide.
36+
you can follow the instructions in the [Getting Started](/adk/quickstart) guide.
3737

3838
</Step>
3939
<Step>

docs/content/docs/crewai-crews/shared-state/in-app-agent-read.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ You can use this when you want to provide the user with a way to read the output
3737
### Run and Connect Your Agent to CopilotKit
3838

3939
You'll need to run your agent and connect it to CopilotKit before proceeding. If you haven't done so already,
40-
you can follow the instructions in the [Getting Started](/getting-started) guide.
40+
you can follow the instructions in the [Getting Started](/crewai-crews/quickstart) guide.
4141

4242
If you don't already have an agent, you can use the [coagent starter](https://github.com/copilotkit/copilotkit/tree/main/examples/coagents-starter-crewai-crews) as a starting point
4343
as this guide uses it as a starting point.

docs/content/docs/crewai-crews/shared-state/in-app-agent-write.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ You can use this when you want to provide the user with a way to update the inpu
3131
<Step>
3232
### Run and Connect Your Agent to CopilotKit
3333

34-
You'll need to run your agent and connect it to CopilotKit before proceeding. If you haven't done so already, you can follow the instructions in the [Getting Started](/getting-started) guide.
34+
You'll need to run your agent and connect it to CopilotKit before proceeding. If you haven't done so already, you can follow the instructions in the [Getting Started](/crewai-crews/quickstart) guide.
3535

3636
If you don't already have an agent, you can use the [coagent starter](https://github.com/copilotkit/copilotkit/tree/main/examples/coagents-starter-crewai-crews) as a starting point
3737
as this guide uses it as a starting point.

docs/content/docs/crewai-flows/shared-state/in-app-agent-read.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ state update you can reflect these updates natively in your application.
3838
### Run and Connect Your Agent to CopilotKit
3939

4040
You'll need to run your agent and connect it to CopilotKit before proceeding. If you haven't done so already,
41-
you can follow the instructions in the [Getting Started](/getting-started) guide.
41+
you can follow the instructions in the [Getting Started](/crewai-flows/quickstart) guide.
4242

4343
If you don't already have an agent, you can use the [coagent starter](https://github.com/copilotkit/copilotkit/tree/main/examples/coagents-starter-crewai-flows) as a starting point
4444
as this guide uses it as a starting point.

docs/content/docs/crewai-flows/shared-state/in-app-agent-write.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ when your agent is calling tools. CopilotKit allows you to fully customize how t
3333
### Run and Connect Your Agent to CopilotKit
3434

3535
You'll need to run your agent and connect it to CopilotKit before proceeding. If you haven't done so already,
36-
you can follow the instructions in the [Getting Started](/getting-started) guide.
36+
you can follow the instructions in the [Getting Started](/crewai-flows/quickstart) guide.
3737

3838
If you don't already have an agent, you can use the [coagent starter](https://github.com/copilotkit/copilotkit/tree/main/examples/coagents-starter-crewai-flows) as a starting point
3939
as this guide uses it as a starting point.

docs/content/docs/pydantic-ai/shared-state/in-app-agent-read.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ state update you can reflect these updates natively in your application.
3232
### Run and Connect Your Agent to CopilotKit
3333

3434
You'll need to run your agent and connect it to CopilotKit before proceeding. If you haven't done so already,
35-
you can follow the instructions in the [Getting Started](/getting-started) guide.
35+
you can follow the instructions in the [Getting Started](/pydantic-ai/quickstart) guide.
3636

3737

3838
</Step>

docs/content/docs/pydantic-ai/shared-state/in-app-agent-write.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ when your agent is calling tools. CopilotKit allows you to fully customize how t
3333
### Run and Connect Your Agent to CopilotKit
3434

3535
You'll need to run your agent and connect it to CopilotKit before proceeding. If you haven't done so already,
36-
you can follow the instructions in the [Getting Started](/getting-started) guide.
36+
you can follow the instructions in the [Getting Started](/pydantic-ai/quickstart) guide.
3737

3838
</Step>
3939
<Step>

docs/snippets/shared/premium/inspector.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ The Copilot Inspector is a debugging aid, accessible from a copilotkit button ov
3131
## How to open
3232

3333
A draggable circular trigger is rendered in-app. Click to open the Inspector.
34-
If no license key is configured, you’ll see a Get License Key prompt.
34+
If no license key is configured, you’ll see a "Get License Key" prompt.

0 commit comments

Comments
 (0)