feat: Support setting <html> in _app template (#1617)

This commit is contained in:
Marvin Hagemeister
2023-08-11 18:40:20 +02:00
committed by GitHub
parent d601f4cef4
commit 86f92114d8
27 changed files with 414 additions and 95 deletions
@@ -0,0 +1,25 @@
import { AppProps, Handler } from "$fresh/server.ts";
export const handler: Handler = (_req, ctx) => {
ctx.state.lang = "de";
return ctx.render();
};
export default function App(
{ Component, state }: AppProps<unknown, { lang: string }>,
) {
return (
<html lang={state.lang}>
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>fresh title</title>
</head>
<body>
<div class="inner-body">
<Component />
</div>
</body>
</html>
);
}
@@ -0,0 +1,12 @@
import { Head } from "$fresh/runtime.ts";
export default function Home() {
return (
<div class="page">
<Head>
<meta name="fresh" content="test" />
</Head>
/head
</div>
);
}
@@ -0,0 +1,7 @@
export default function Home() {
return (
<div class="page">
Home
</div>
);
}
@@ -0,0 +1,12 @@
import { Head } from "$fresh/runtime.ts";
export default function Home() {
return (
<div class="page">
<Head>
<title>foo bar</title>
</Head>
/title
</div>
);
}