mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-27 08:29:40 +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,12 +1,30 @@
|
|||
import { ProfilePage } from "#/pages/Profile";
|
||||
import { fetchDataViaGet } from "#/api/utils";
|
||||
import type { Metadata, ResolvingMetadata } from "next";
|
||||
|
||||
export async function generateMetadata({ params }) {
|
||||
const id:string = params.id;
|
||||
const profile: any = await fetchDataViaGet(`https://api.anixart.tv/profile/${id}`);
|
||||
export async function generateMetadata(
|
||||
{ params },
|
||||
parent: ResolvingMetadata
|
||||
): Promise<Metadata> {
|
||||
const id: string = params.id;
|
||||
const profile: any = await fetchDataViaGet(
|
||||
`https://api.anixart.tv/profile/${id}`
|
||||
);
|
||||
const previousOG = (await parent).openGraph;
|
||||
|
||||
return {
|
||||
title: "Профиль " + profile.profile.login,
|
||||
title: "Профиль - " + profile.profile.login,
|
||||
description: profile.profile.status,
|
||||
openGraph: {
|
||||
...previousOG,
|
||||
images: [
|
||||
{
|
||||
url: profile.profile.avatar, // Must be an absolute URL
|
||||
width: 600,
|
||||
height: 600,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue