From 593bae6aabb327ac13b31ec4c268637107c4e7f8 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 24 Jul 2024 15:09:56 +0200 Subject: [PATCH] Add `/go/...` links to link to from CLI --- _config.ts | 1 + go.json | 5 +++++ server.ts | 5 +++++ 3 files changed, 11 insertions(+) create mode 100644 go.json diff --git a/_config.ts b/_config.ts index 477e9d73d..f735d00ed 100644 --- a/_config.ts +++ b/_config.ts @@ -74,6 +74,7 @@ site.copy("deploy/kv/manual/images"); site.copy("deploy/kv/tutorials/images"); site.copy("runtime/manual/images"); site.copy("deno.json"); +site.copy("go.json"); site.copy("server.ts"); site.copy("middleware.ts"); diff --git a/go.json b/go.json new file mode 100644 index 000000000..387f76254 --- /dev/null +++ b/go.json @@ -0,0 +1,5 @@ +{ + "permissions": "/runtime/manual/basics/permissions/", + "config": "/runtime/manual/getting_started/configuration_file/", + "ide": "/runtime/manual/getting_started/setup_your_environment/#using-an-editor%2Fide" +} diff --git a/server.ts b/server.ts index 44ceda26f..0aa22e47c 100644 --- a/server.ts +++ b/server.ts @@ -1,5 +1,6 @@ import Server from "lume/core/server.ts"; import REDIRECTS from "./_redirects.json" with { type: "json" }; +import GO_LINKS from "./go.json" with { type: "json" }; import { type Event, formatStatus, @@ -17,6 +18,10 @@ const server = new Server({ REDIRECTS["/api/"] = "/api/deno/"; +for (const [name, url] of Object.entries(GO_LINKS)) { + REDIRECTS[`/go/${name}/`] = url; +} + const GA4_MEASUREMENT_ID = Deno.env.get("GA4_MEASUREMENT_ID"); function ga4( request: Request,