icon sharp
This commit is contained in:
@@ -19,11 +19,21 @@ export async function generateMetadata({
|
||||
try {
|
||||
const restaurant = await getRestaurant(name)
|
||||
|
||||
const favicon = restaurant.logo || "/icons/web-app-manifest-192x192.png"
|
||||
const title = restaurant.seoTitle || restaurant.name
|
||||
const logo = restaurant.logo
|
||||
|
||||
const defaultIcon = "/icons/web-app-manifest-192x192.png"
|
||||
const iconUrl = favicon || defaultIcon
|
||||
|
||||
// استفاده از API route برای تبدیل لوگو به مربع
|
||||
let iconUrl = defaultIcon
|
||||
let icon192Url = defaultIcon
|
||||
let icon512Url = "/icons/web-app-manifest-512x512.png"
|
||||
|
||||
if (logo && logo.trim() !== "") {
|
||||
iconUrl = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`
|
||||
icon192Url = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`
|
||||
icon512Url = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=512`
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
@@ -32,8 +42,8 @@ export async function generateMetadata({
|
||||
icons: {
|
||||
icon: [
|
||||
{ url: iconUrl },
|
||||
{ url: iconUrl, sizes: "192x192", type: "image/png" },
|
||||
{ url: iconUrl, sizes: "512x512", type: "image/png" },
|
||||
{ url: icon192Url, sizes: "192x192", type: "image/png" },
|
||||
{ url: icon512Url, sizes: "512x512", type: "image/png" },
|
||||
],
|
||||
shortcut: iconUrl,
|
||||
apple: iconUrl,
|
||||
|
||||
Reference in New Issue
Block a user