diff --git a/public/img/default_og.jpg b/public/img/default_og.jpg new file mode 100644 index 0000000..5ab1582 Binary files /dev/null and b/public/img/default_og.jpg differ diff --git a/src/components/AppLayout/AppEmptyLayout.astro b/src/components/AppLayout/AppEmptyLayout.astro index 6dd1233..4d90f1f 100644 --- a/src/components/AppLayout/AppEmptyLayout.astro +++ b/src/components/AppLayout/AppEmptyLayout.astro @@ -4,20 +4,21 @@ import Topbar from "./components/Topbar/Topbar.astro"; import Footer from "./components/Footer.astro"; import type { ParentPage } from "src/shared/payload/payload-sdk"; import AppLayoutBackgroundImg from "./components/AppLayoutBackgroundImg.astro"; +import type { ComponentProps } from "astro/types"; interface Props { + openGraph?: ComponentProps["openGraph"]; parentPages?: ParentPage[]; - metaTitle?: string; hideFooterLinks?: boolean; backgroundIllustration?: string | undefined; } -const { metaTitle, hideFooterLinks = false, parentPages, backgroundIllustration } = Astro.props; +const { openGraph, hideFooterLinks = false, parentPages, backgroundIllustration } = Astro.props; --- {/* ------------------------------------------- HTML ------------------------------------------- */} - +
{backgroundIllustration && } diff --git a/src/components/AppLayout/AppLayout.astro b/src/components/AppLayout/AppLayout.astro index ea1290d..e2b5d8f 100644 --- a/src/components/AppLayout/AppLayout.astro +++ b/src/components/AppLayout/AppLayout.astro @@ -7,9 +7,10 @@ import AppLayoutTitle from "./components/AppLayoutTitle.astro"; import type { ComponentProps } from "astro/types"; interface Props { + openGraph?: ComponentProps["openGraph"]; parentPages?: ComponentProps["parentPages"]; pretitle?: string | undefined; - title: string; + title?: string; subtitle?: string | undefined; description?: string | undefined; illustration?: string; @@ -21,6 +22,7 @@ interface Props { } const { + openGraph, title, subtitle, pretitle, @@ -37,7 +39,7 @@ const { {/* ------------------------------------------- HTML ------------------------------------------- */} - +
{backgroundIllustration && } @@ -47,7 +49,7 @@ const {
- + {title && }
diff --git a/src/components/AppLayout/components/Html.astro b/src/components/AppLayout/components/Html.astro index bd50a08..49725c7 100644 --- a/src/components/AppLayout/components/Html.astro +++ b/src/components/AppLayout/components/Html.astro @@ -3,12 +3,34 @@ import UAParser from "ua-parser-js"; import { ViewTransitions } from "astro:transitions"; import "@fontsource-variable/vollkorn"; import "@fontsource-variable/murecho"; +import { getI18n } from "src/i18n/i18n"; interface Props { - title?: string | undefined; + openGraph?: + | { + title?: string | undefined; + description?: string | undefined; + thumbnail?: string | undefined; + audio?: string | undefined; + video?: string | undefined; + } + | undefined; } -const { title = "Accord’s Library" } = Astro.props; +const { currentLocale } = Astro.locals; +const { t } = await getI18n(currentLocale); + +const { openGraph = {} } = Astro.props; +const { + description = t("global.meta.description"), + thumbnail = "/img/default_og.jpg", + audio, + video, +} = openGraph; + +const title = openGraph.title + ? `${t("global.siteName")} – ${openGraph.title}` + : t("global.siteName"); const userAgent = Astro.request.headers.get("user-agent") ?? ""; const parser = new UAParser(userAgent); @@ -21,7 +43,7 @@ const { currentTheme } = Astro.locals; --- - + - {title} - + + {/* Meta & OpenGraph */} + {title} + + + + + + + + + + + + + + + + + + + + + + { + audio && ( + <> + + + + ) + } + { + video && ( + <> + + + + ) + } +