Skip to content

Commit

Permalink
chore(website): redirect /api to doc.deno.land
Browse files Browse the repository at this point in the history
  • Loading branch information
gabeidx committed Jul 15, 2022
1 parent b2441fa commit 4ec224f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions website/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ async function handler(request: Request): Promise<Response> {
};
// early return to bypass template layout
return new Response(body, { status, headers });
} // docs
else if (["/docs", "/documentation"].includes(pathname)) {
} // api (deno doc)
else if (["/api"].includes(pathname)) {
status = 307;
headers = {
...headers,
"location": "https://doc.deno.land/https://deno.land/x/atlas",
};
} // other routes
else {
// try /[route].html first
try {
body = await Deno.readTextFile(`${cwd}/${pathname}.html`);
} // fallback to `/[route]/index.html`
Expand Down
2 changes: 1 addition & 1 deletion website/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
<header class="flex items-center space-x-4 px-4 py-2 md:py-4 lg:px-8 lg:py-6">
<a href="/">[Logo]</a>
<nav class="flex items-center flex-1 space-x-4">
<a href="/guide">Guide</a>
<a href="/docs">Documentation</a>
<a href="/api">API</a>
<a href="/examples">Examples</a>
<a href="/changelog">Changelog</a>
<span class="flex-1"></span>
Expand Down

0 comments on commit 4ec224f

Please sign in to comment.