mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-29 17:39:41 +05:00
feat: add openGraph metadata
This commit is contained in:
parent
a5c19eadea
commit
8afa3ef664
12 changed files with 100 additions and 34 deletions
|
@ -1,13 +1,26 @@
|
|||
import { RelatedPage } from "#/pages/Related";
|
||||
import { fetchDataViaGet } from "#/api/utils";
|
||||
import type { Metadata, ResolvingMetadata } from "next";
|
||||
|
||||
export async function generateMetadata({ params }) {
|
||||
export async function generateMetadata({ params }, parent: ResolvingMetadata): Promise<Metadata> {
|
||||
const id:string = params.id;
|
||||
const related: any = await fetchDataViaGet(`https://api.anixart.tv/related/${id}/0`);
|
||||
const firstRelease: any = await fetchDataViaGet(`https://api.anixart.tv/release/${related.content[0].id}`);
|
||||
const previousOG = (await parent).openGraph;
|
||||
|
||||
return {
|
||||
title: "Франшиза " + firstRelease.release.related.name_ru || firstRelease.release.related.name,
|
||||
title: "Франшиза - " + firstRelease.release.related.name_ru || firstRelease.release.related.name,
|
||||
description: firstRelease.release.description,
|
||||
openGraph: {
|
||||
...previousOG,
|
||||
images: [
|
||||
{
|
||||
url: firstRelease.release.image, // Must be an absolute URL
|
||||
width: 600,
|
||||
height: 800,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue