feat: Support setting <html> in _app template (#1617)
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user