diff --git a/README.md b/README.md
index cec48872..968c5d28 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ You can scaffold a new project by running the Fresh init script. To scaffold a
project in the `myproject` folder, run the following:
```sh
-deno run -A https://raw.githubusercontent.com/lucacasonato/fresh/main/init.ts my-project
+deno run -A https://fresh.deno.dev my-project
```
To now start the project, use `deno task`:
diff --git a/docs/getting-started/create-a-project.md b/docs/getting-started/create-a-project.md
index df3e3579..b780e3bc 100644
--- a/docs/getting-started/create-a-project.md
+++ b/docs/getting-started/create-a-project.md
@@ -10,7 +10,7 @@ will scaffold out a new project with some example files to get you started.
To create a new project in the directory `"my-project"`, run:
```
-$ deno run -A https://raw.githubusercontent.com/lucacasonato/fresh/main/init.ts my-project
+$ deno run -A https://fresh.deno.dev my-project
The manifest has been generated for 3 routes and 1 islands.
Project created!
diff --git a/www/routes/index.tsx b/www/routes/index.tsx
index ce949c3a..0ad43d7b 100644
--- a/www/routes/index.tsx
+++ b/www/routes/index.tsx
@@ -2,13 +2,28 @@
/** @jsxFrag Fragment */
import { ComponentChildren, Fragment, h } from "preact";
import { asset, Head } from "$fresh/runtime.ts";
-import { PageProps } from "$fresh/server.ts";
+import { Handlers, PageProps } from "$fresh/server.ts";
import { tw } from "../utils/twind.ts";
import Counter from "../islands/Counter.tsx";
import LemonDrop from "../islands/LemonDrop.tsx";
import Footer from "../components/Footer.tsx";
import WarningBanner from "../components/WarningBanner.tsx";
import { Leaf } from "../components/Icons.tsx";
+import VERSIONS from "../../versions.json" assert { type: "json" };
+
+export const handler: Handlers = {
+ GET(req, ctx) {
+ const accept = req.headers.get("accept");
+ if (accept && !accept.includes("text/html")) {
+ const path = `/@${VERSIONS[0]}/init.ts`;
+ return new Response(`Redirecting to ${path}`, {
+ headers: { "Location": path },
+ status: 307,
+ });
+ }
+ return ctx.render();
+ },
+};
const TITLE = "fresh - The next-gen web framework.";
const DESCRIPTION =
@@ -16,6 +31,7 @@ const DESCRIPTION =
export default function MainPage(props: PageProps) {
const ogImageUrl = new URL(asset("/home-og.png"), props.url).href;
+ const origin = `${props.url.protocol}//${props.url.host}`;
return (
<>
@@ -30,7 +46,7 @@ export default function MainPage(props: PageProps) {
-
+
>
@@ -138,7 +154,7 @@ function Intro() {
);
}
-function GettingStarted() {
+function GettingStarted(props: { origin: string }) {
return (
- {"deno run -A https://raw.githubusercontent.com/lucacasonato/fresh/main/init.ts my-app"}
+ {`deno run -A ${props.origin} my-app`}
Enter the newly created project directory and run the following command