icon sharp

This commit is contained in:
hamid zarghami
2025-12-30 10:38:58 +03:30
parent 919c4ff568
commit ca53e15d49
5 changed files with 588 additions and 455 deletions
+14 -4
View File
@@ -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,