This repository has been archived on 2024-07-16. You can view files and clone it, but cannot push or open issues or pull requests.
www.local-ip.sh/app/root.tsx

81 lines
2.4 KiB
TypeScript
Raw Normal View History

2023-12-11 14:19:17 +00:00
import { cssBundleHref } from "@remix-run/css-bundle";
2023-12-22 22:56:54 +00:00
import { json, type SerializeFrom, type LinksFunction, type MetaFunction } from "@remix-run/node";
2023-12-22 22:59:14 +00:00
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from "@remix-run/react";
2023-12-11 14:19:17 +00:00
2023-12-13 20:48:50 +00:00
import useFathom from "./hooks/use-fathom";
2023-12-22 22:56:54 +00:00
export const meta: MetaFunction = () => [
2023-12-22 22:59:14 +00:00
{ name: "title", content: "local-ip.sh" },
{
name: "description",
content: "local-ip.sh is a magic domain name that provides wildcard DNS for any IP address.",
},
{ name: "author", content: "Mokhtar Mial" },
{ name: "robots", content: "index,follow" },
{ name: "googlebot", content: "index,follow" },
{ property: "twitter:title", content: "local-ip.sh" },
{
property: "twitter:description",
content: "local-ip.sh is a magic domain name that provides wildcard DNS for any IP address.",
},
{ property: "twitter:card", content: "summary_large_image" },
{ property: "twitter:site", content: "https://local-ip.sh/" },
{ property: "twitter:image", content: "https://local-ip.sh/og.png" },
{ property: "twitter:image:alt", content: "og image" },
{ property: "og:title", content: "local-ip.sh" },
{
property: "og:description",
content: "local-ip.sh is a magic domain name that provides wildcard DNS for any IP address.",
},
{ property: "og:url", content: "https://local-ip.sh/" },
{ property: "og:type", content: "website" },
{ property: "og:image", content: "https://local-ip.sh/og.png" },
{ property: "og:image:alt", content: "og image" },
2023-12-22 22:56:54 +00:00
];
2023-12-22 22:59:14 +00:00
export const links: LinksFunction = () => [...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : [])];
2023-12-11 14:19:17 +00:00
2023-12-13 20:48:50 +00:00
export const loader = () =>
2023-12-22 22:59:14 +00:00
json({
siteConfig: {
fathom: {
siteId: process.env.FATHOM_SITE_ID!,
domain: process.env.FATHOM_CUSTOM_DOMAIN!,
},
},
});
2023-12-13 20:48:50 +00:00
declare global {
2023-12-22 22:59:14 +00:00
interface Window {
siteConfig: SerializeFrom<typeof loader>["siteConfig"];
}
2023-12-13 20:48:50 +00:00
}
2023-12-11 14:19:17 +00:00
export default function App() {
2023-12-22 22:59:14 +00:00
const { siteConfig } = useLoaderData<typeof loader>();
useFathom();
2023-12-13 20:48:50 +00:00
2023-12-22 22:59:14 +00:00
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1" />
<Meta />
<Links />
</head>
<body>
<Outlet />
<script
suppressHydrationWarning
dangerouslySetInnerHTML={{
__html: `window.siteConfig=${JSON.stringify(siteConfig)};`,
}}
/>
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
2023-12-11 14:19:17 +00:00
}