feat: bring back <Head> component (#3249)

This PR brings back the `<Head>` component from Fresh 1.x . The
implementation is much cleaner than back then and also works client-side
now too.
This commit is contained in:
Marvin Hagemeister
2025-08-25 15:40:47 +02:00
committed by GitHub
parent bf25d10a84
commit 1daca75489
27 changed files with 916 additions and 326 deletions
@@ -0,0 +1,22 @@
import type { PageProps } from "@fresh/core";
export default function Page({ Component }: PageProps) {
return (
<html lang="en">
<head>
<meta charset="utf-8" />
<title>not ok</title>
<meta name="foo" content="not ok" />
<meta name="bar" content="not ok" />
<style>not ok</style>
<style id="style-id">not ok</style>
<template key="a">not ok</template>
<template key="b">not ok</template>
<template>not ok</template>
</head>
<body>
<Component />
</body>
</html>
);
}
@@ -0,0 +1,5 @@
import { StyleIdIsland } from "../islands/StyleIdIsland.tsx";
export default function Page() {
return <StyleIdIsland />;
}
@@ -0,0 +1,5 @@
import { TemplateIsland } from "../islands/TemplateIsland.tsx";
export default function Page() {
return <TemplateIsland />;
}
@@ -0,0 +1,5 @@
import { MetaIsland } from "../islands/MetaIsland.tsx";
export default function Page() {
return <MetaIsland />;
}
@@ -0,0 +1,5 @@
import { TitleIsland } from "../islands/TitleIsland.tsx";
export default function Page() {
return <TitleIsland />;
}