import { asset, Head } from "$fresh/runtime.ts"; import { Handlers, PageProps } from "$fresh/server.ts"; import Counter from "../islands/Counter.tsx"; import LemonDrop from "../islands/LemonDrop.tsx"; import Footer from "../components/Footer.tsx"; import VERSIONS from "../../versions.json" assert { type: "json" }; import * as FeatureIcons from "../components/FeatureIcons.tsx"; import CopyArea from "../islands/CopyArea.tsx"; import * as Icons from "../components/Icons.tsx"; import Projects from "../components/Projects.tsx"; import projects from "../data/showcase.json" assert { type: "json" }; import Header from "../components/Header.tsx"; function isOpenGraphUA(header: string | null): boolean { if (!header) { return false; } return header.startsWith("Twitterbot") || header.startsWith("Slackbot"); } export const handler: Handlers = { GET(req, ctx) { const accept = req.headers.get("accept"); const userAgent = req.headers.get("user-agent"); if (!accept?.includes("text/html") && !isOpenGraphUA(userAgent)) { const path = `https://deno.land/x/fresh@${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 = "Just in time edge rendering, island based interactivity, and no configuration TypeScript support using Deno."; 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 ( <>
Fresh embraces the tried and true design of server side rendering and progressive enhancement on the client side.
Fresh optimizes the page by only shipping JavaScript for areas that need it. The rest is completely static HTML rendered by the server. This means the browser needs to load less code and can display pages more quickly.
Below is a selection of projects that have been built with Fresh.
Jump right in and build your website with Fresh. Learn everything you need to know in seconds.
Get started