feat: improve metadata (#1308)

This commit is contained in:
Meier Lukas
2024-10-17 12:38:38 +02:00
committed by GitHub
parent a44c907745
commit 0df7cb5c25
2 changed files with 20 additions and 8 deletions

View File

@@ -49,6 +49,10 @@ export const createBoardContentPage = <TParams extends Record<string, unknown>>(
title: board.metaTitle ?? createMetaTitle(t("board.content.metaTitle", { boardName: board.name })), title: board.metaTitle ?? createMetaTitle(t("board.content.metaTitle", { boardName: board.name })),
icons: { icons: {
icon: board.faviconImageUrl ? board.faviconImageUrl : undefined, icon: board.faviconImageUrl ? board.faviconImageUrl : undefined,
apple: board.faviconImageUrl ? board.faviconImageUrl : undefined,
},
appleWebApp: {
startupImage: { url: board.faviconImageUrl ? board.faviconImageUrl : "/logo/logo.png" },
}, },
}; };
} catch (error) { } catch (error) {

View File

@@ -28,8 +28,7 @@ const fontSans = Inter({
variable: "--font-sans", variable: "--font-sans",
}); });
export const metadata: Metadata = { export const generateMetadata = (): Metadata => ({
metadataBase: new URL("http://localhost:3000"),
title: "Homarr", title: "Homarr",
description: description:
"Simplify the management of your server with Homarr - a sleek, modern dashboard that puts all of your apps and services at your fingertips.", "Simplify the management of your server with Homarr - a sleek, modern dashboard that puts all of your apps and services at your fingertips.",
@@ -40,12 +39,17 @@ export const metadata: Metadata = {
url: "https://homarr.dev", url: "https://homarr.dev",
siteName: "Homarr Documentation", siteName: "Homarr Documentation",
}, },
twitter: { icons: {
card: "summary_large_image", icon: "/logo/logo.png",
site: "@jullerino", apple: "/logo/logo.png",
creator: "@jullerino",
}, },
}; appleWebApp: {
title: "Homarr",
capable: true,
startupImage: { url: "/logo/logo.png" },
statusBarStyle: getColorScheme() === "dark" ? "black-translucent" : "default",
},
});
export const viewport: Viewport = { export const viewport: Viewport = {
themeColor: [ themeColor: [
@@ -56,7 +60,7 @@ export const viewport: Viewport = {
export default async function Layout(props: { children: React.ReactNode; params: { locale: string } }) { export default async function Layout(props: { children: React.ReactNode; params: { locale: string } }) {
const session = await auth(); const session = await auth();
const colorScheme = cookies().get("homarr-color-scheme")?.value ?? "dark"; const colorScheme = getColorScheme();
const tCommon = await getScopedI18n("common"); const tCommon = await getScopedI18n("common");
const direction = tCommon("direction"); const direction = tCommon("direction");
@@ -95,3 +99,7 @@ export default async function Layout(props: { children: React.ReactNode; params:
</html> </html>
); );
} }
const getColorScheme = () => {
return cookies().get("homarr-color-scheme")?.value ?? "dark";
};