Page MenuHomeSealhub

html.tsx
No OneTemporary

html.tsx

import type { HTMLArgs, HTMLOptions } from "@sealcode/sealgen";
import { tempstreamAsync } from "tempstream";
import type { Readable } from "stream";
import { toKebabCase } from "js-convert-case";
import { DEFAULT_HTML_LANG } from "./config.js";
import { default_navbar } from "./routes/common/navbar.js";
import { defaultHead } from "./defaultHead.js";
const default_html_options: Partial<HTMLOptions> = {
showFooter: true,
showBottomNavbar: true,
loadHamburgerMenu: true,
loadSearchModal: true,
};
export default function html({
ctx,
title,
body,
htmlOptions = {},
makeHead = defaultHead,
metaImage,
canonicalPath,
css_clumps = [],
description,
hideNavigation = false,
}: HTMLArgs): Readable {
htmlOptions = { ...default_html_options, ...htmlOptions };
ctx.set(
"content-type",
htmlOptions.canHaveStreams &&
ctx.get("accept").includes("text/vnd.turbo-stream.html")
? "text/vnd.turbo-stream.html"
: "text/html;charset=utf-8"
);
const controllers: string[] = [];
if (htmlOptions.autoRefreshCSS) {
controllers.push("refresh-styles");
controllers.push("refresh-on-ts-changes");
}
return tempstreamAsync/* HTML */ ` <!DOCTYPE html>
<html
lang="${htmlOptions.language || DEFAULT_HTML_LANG}"
class="title--${typeof title == "string" ? toKebabCase(title) : ""}"
>
<head>
<meta
name="google-site-verification"
content="Tf9a888qUgbgQJS4u1F6A8H7ZI_DBJvAeduluSI0T_g"
/>
${makeHead({
ctx,
title: title,
htmlOptions: { ...htmlOptions },
metaImage,
canonicalPath,
css_clumps,
description,
})}
</head>
<body
data-controller="${controllers.join(" ")}"
class="${(htmlOptions?.bodyClasses || []).join(" ")}"
>
${!hideNavigation ? (htmlOptions?.navbar || default_navbar)(ctx) : ""}
${body}
</body>
</html>`;
}

File Metadata

Mime Type
text/html
Expires
Tue, Dec 24, 14:02 (20 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557127
Default Alt Text
html.tsx (1 KB)

Event Timeline