🐛 fix(metadata): Global metadata
This commit is contained in:
parent
74cb16b1ae
commit
15d5ecfc80
@ -13,25 +13,31 @@ import NextTopLoader from 'nextjs-toploader';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export async function generateMetadata(): Promise<Metadata> {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
const config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data!);
|
try {
|
||||||
const site = config.site || {};
|
const config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data!);
|
||||||
return {
|
const site = config.site || {};
|
||||||
title: {
|
return {
|
||||||
default: `${site.site_name}`,
|
title: {
|
||||||
template: `%s | ${site.site_name}`,
|
default: `${site.site_name}`,
|
||||||
},
|
template: `%s | ${site.site_name}`,
|
||||||
description: site.site_desc,
|
},
|
||||||
icons: {
|
description: site.site_desc,
|
||||||
icon: site.site_logo
|
icons: {
|
||||||
? [
|
icon: site.site_logo
|
||||||
{
|
? [
|
||||||
url: site.site_logo,
|
{
|
||||||
sizes: 'any',
|
url: site.site_logo,
|
||||||
},
|
sizes: 'any',
|
||||||
]
|
},
|
||||||
: [],
|
]
|
||||||
},
|
: [],
|
||||||
};
|
},
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
title: { default: 'PPanel', template: '%s | PPanel' },
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
|||||||
@ -13,25 +13,31 @@ import NextTopLoader from 'nextjs-toploader';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export async function generateMetadata(): Promise<Metadata> {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
const config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data!);
|
try {
|
||||||
const site = config?.site || {};
|
const config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data!);
|
||||||
return {
|
const site = config.site || {};
|
||||||
title: {
|
return {
|
||||||
default: `${site.site_name}`,
|
title: {
|
||||||
template: `%s | ${site.site_name}`,
|
default: `${site.site_name}`,
|
||||||
},
|
template: `%s | ${site.site_name}`,
|
||||||
description: site.site_desc,
|
},
|
||||||
icons: {
|
description: site.site_desc,
|
||||||
icon: site.site_logo
|
icons: {
|
||||||
? [
|
icon: site.site_logo
|
||||||
{
|
? [
|
||||||
url: site.site_logo,
|
{
|
||||||
sizes: 'any',
|
url: site.site_logo,
|
||||||
},
|
sizes: 'any',
|
||||||
]
|
},
|
||||||
: [],
|
]
|
||||||
},
|
: [],
|
||||||
};
|
},
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
title: { default: 'PPanel', template: '%s | PPanel' },
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user