Add head details for collections

This commit is contained in:
Zoe Roux 2023-11-04 22:29:41 +01:00
parent 9084a78420
commit d73a37fbed
4 changed files with 9 additions and 2 deletions

View File

@ -21,9 +21,11 @@
export const Head = ({ export const Head = ({
title, title,
description, description,
image,
}: { }: {
title?: string | null; title?: string | null;
description?: string | null; description?: string | null;
image?: string | null;
}) => { }) => {
return null; return null;
}; };

View File

@ -23,14 +23,17 @@ import NextHead from "next/head";
export const Head = ({ export const Head = ({
title, title,
description, description,
image,
}: { }: {
title?: string | null; title?: string | null;
description?: string | null; description?: string | null;
image?: string | null;
}) => { }) => {
return ( return (
<NextHead> <NextHead>
{title && <title>{title + " - Kyoo"}</title>} {title && <title>{title + " - Kyoo"}</title>}
{description && <meta name="description" content={description} />} {description && <meta name="description" content={description} />}
{image && <meta property="og:image" content={image} />}
</NextHead> </NextHead>
); );
}; };

View File

@ -29,7 +29,7 @@ import {
getDisplayDate, getDisplayDate,
} from "@kyoo/models"; } from "@kyoo/models";
import { Header as ShowHeader, TitleLine } from "../details/header"; import { Header as ShowHeader, TitleLine } from "../details/header";
import { Container, ImageBackground, P, Skeleton, ts } from "@kyoo/primitives"; import { Container, Head, ImageBackground, P, Skeleton, ts } from "@kyoo/primitives";
import { percent, px, useYoshiki } from "yoshiki/native"; import { percent, px, useYoshiki } from "yoshiki/native";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { forwardRef } from "react"; import { forwardRef } from "react";
@ -48,6 +48,8 @@ const Header = ({ slug }: { slug: string }) => {
<Fetch query={Header.query(slug)}> <Fetch query={Header.query(slug)}>
{({ isLoading, ...data }) => ( {({ isLoading, ...data }) => (
<> <>
<Head title={data?.name} description={data?.overview} image={data?.thumbnail?.high} />
<ImageBackground <ImageBackground
src={data?.thumbnail} src={data?.thumbnail}
quality="high" quality="high"

View File

@ -386,7 +386,7 @@ export const Header = ({
<Fetch query={query}> <Fetch query={query}>
{({ isLoading, ...data }) => ( {({ isLoading, ...data }) => (
<> <>
<Head title={data?.name} description={data?.overview} /> <Head title={data?.name} description={data?.overview} image={data?.thumbnail?.high} />
<ImageBackground <ImageBackground
src={data?.thumbnail} src={data?.thumbnail}
quality="high" quality="high"