Skip to content

Commit fb36967

Browse files
committed
Fixup
1 parent f456388 commit fb36967

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

docs/.vuepress/client.ts

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,23 @@ import KapaWidget from './components/KapaWidget.vue';
77
import UserFeedback from './components/TocWithFeedback';
88
import {usePostHog} from "./lib/usePosthog";
99

10-
declare const __VERSIONS__: { latest: string, selected: string, all: string[] }
10+
declare const __VERSIONS__: {
11+
latest: string,
12+
selected: string,
13+
all: {
14+
id: string,
15+
group: string,
16+
basePath: string,
17+
versions: {
18+
version: string,
19+
path: string,
20+
startPage: string,
21+
preview?: boolean,
22+
deprecated?: boolean,
23+
hide?: boolean
24+
}[]
25+
}[]
26+
}
1127

1228
const storageKey = "VUEPRESS_TAB_STORE";
1329

@@ -98,20 +114,10 @@ export default defineClientConfig({
98114
}
99115
}, 0);
100116
});
101-
const operatorLatest = __VERSIONS__.all.filter(x => x.id == 'kubernetes-operator')[0].versions[0].version;
117+
const operatorLatest = __VERSIONS__.all.filter(x => x.id === 'kubernetes-operator')[0].versions[0].version;
102118
addDynamicRoute("/server/kubernetes-operator", to => `/server/kubernetes-operator/${operatorLatest}/getting-started/`);
103119
addDynamicRoute("/server/kubernetes-operator/:version", to => `/server/kubernetes-operator/${to.params.version}/getting-started/`);
104120

105-
const dotnetClientLatest = __VERSIONS__.all.filter(x => x.id == 'dotnet-client')[0].versions[0].version;
106-
addDynamicRoute("/clients/grpc/dotnet", to => `/clients/grpc/dotnet/${dotnetClientLatest}/getting-started.html`);
107-
108-
// // TODO: Uncomment until we finish writing the docs for the other clients
109-
// addDynamicRoute('/clients/grpc/:lang',
110-
// to => {
111-
// const latest = __VERSIONS__.all.filter(x => x.id == `${to.params.lang}-client`)[0].versions[0].version;
112-
// return `/clients/grpc/${to.params.lang}/${latest}/getting-started.html`
113-
// });
114-
115121
addDynamicRoute("/server/:version", to => `/server/${to.params.version}/quick-start/`);
116122
addDynamicRoute('/client/:lang',
117123
to => {
@@ -124,6 +130,15 @@ export default defineClientConfig({
124130
addFixedRoute("/server/latest", `/${__VERSIONS__.latest}/quick-start/`);
125131
addFixedRoute("/latest", `/${__VERSIONS__.latest}/quick-start/`);
126132
addFixedRoute("/latest.html", `/${__VERSIONS__.latest}/quick-start/`);
133+
134+
// .NET client redirect to latest version (dynamic)
135+
const dotnetClient = __VERSIONS__.all.find(x => x.id === 'dotnet-client');
136+
if (dotnetClient && dotnetClient.versions.length > 0) {
137+
const latestDotnetVersion = dotnetClient.versions[0].version;
138+
const startPage = dotnetClient.versions[0].startPage || 'getting-started.html';
139+
addFixedRoute("/clients/grpc/dotnet/latest/", `/clients/grpc/dotnet/${latestDotnetVersion}/${startPage}`);
140+
addFixedRoute("/clients/grpc/dotnet/latest", `/clients/grpc/dotnet/${latestDotnetVersion}/${startPage}`);
141+
}
127142

128143
router.afterEach((to, from) => {
129144
if (typeof window === "undefined" || to.path === from.path || removeHtml(to.path) === removeHtml(from.path)) return;

docs/.vuepress/configs/navbar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const navbarEn: NavbarOptions = [
2727
{
2828
text: "Clients",
2929
children: [
30-
{ text: ".NET", link: `/clients/grpc/dotnet/` },
30+
{ text: ".NET", link: `/clients/grpc/dotnet/latest/` },
3131
{ text: "Python", link: "/clients/grpc/python/getting-started.html" },
3232
{ text: "Node.js", link: "/clients/grpc/nodejs/getting-started.html" },
3333
{ text: "Java", link: "/clients/grpc/java/getting-started.html" },

0 commit comments

Comments
 (0)