Render CMS meta tags and trust badges from business-info.
Injects dashboard-managed meta tags in the head and eNamad/Samandehi HTML in the footer, and enables Next standalone output for deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
804eb8702f
commit
f60c98184b
@@ -1,6 +1,7 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
|
// Leaner production runtime: deploy uses .next/standalone and drops node_modules.
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
allowedDevOrigins: ["sanihome.com", "localhost"],
|
allowedDevOrigins: ["sanihome.com", "localhost"],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,10 +29,16 @@ const syne = Syne({
|
|||||||
|
|
||||||
export async function generateMetadata(): Promise<Metadata> {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
const businessInfo = await getBusinessInfo();
|
const businessInfo = await getBusinessInfo();
|
||||||
|
const other: Record<string, string> = {};
|
||||||
|
for (const tag of businessInfo?.metaTags ?? []) {
|
||||||
|
if (tag.name && tag.content) other[tag.name] = tag.content;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: "صنیع هوم | فروشگاه لوازم خانگی",
|
title: "صنیع هوم | فروشگاه لوازم خانگی",
|
||||||
description: "فروشگاه آنلاین لوازم خانگی — یخچال، لباسشویی، تلویزیون و بیشتر",
|
description: "فروشگاه آنلاین لوازم خانگی — یخچال، لباسشویی، تلویزیون و بیشتر",
|
||||||
icons: businessInfo?.faviconUrl ? [{ url: businessInfo.faviconUrl }] : undefined,
|
icons: businessInfo?.faviconUrl ? [{ url: businessInfo.faviconUrl }] : undefined,
|
||||||
|
...(Object.keys(other).length > 0 ? { other } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,18 @@ export function Footer({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{businessInfo?.trustBadges && businessInfo.trustBadges.length > 0 ? (
|
||||||
|
<div className="mt-10 flex flex-wrap items-center justify-center gap-4 border-t border-black/10 pt-6">
|
||||||
|
{businessInfo.trustBadges.map((badge) => (
|
||||||
|
<div
|
||||||
|
key={badge.kind}
|
||||||
|
className="trust-badge [&_img]:max-h-16 [&_a]:inline-block"
|
||||||
|
dangerouslySetInnerHTML={{ __html: badge.embedHtml }}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<div className="mt-10 flex flex-col items-center justify-between gap-3 border-t border-black/10 pt-6 text-xs text-black/50 md:flex-row">
|
<div className="mt-10 flex flex-col items-center justify-between gap-3 border-t border-black/10 pt-6 text-xs text-black/50 md:flex-row">
|
||||||
<p>© ۱۴۰۵ صنیع هوم — تمامی حقوق محفوظ است.</p>
|
<p>© ۱۴۰۵ صنیع هوم — تمامی حقوق محفوظ است.</p>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -44,6 +44,16 @@ async function apiPost<T>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type BusinessMetaTag = {
|
||||||
|
name: string;
|
||||||
|
content: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BusinessTrustBadge = {
|
||||||
|
kind: "enamad" | "samandehi";
|
||||||
|
embedHtml: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type BusinessInfo = {
|
export type BusinessInfo = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -64,6 +74,8 @@ export type BusinessInfo = {
|
|||||||
aparat?: string;
|
aparat?: string;
|
||||||
};
|
};
|
||||||
addresses: string[];
|
addresses: string[];
|
||||||
|
metaTags?: BusinessMetaTag[];
|
||||||
|
trustBadges?: BusinessTrustBadge[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getBusinessInfo(): Promise<BusinessInfo | null> {
|
export async function getBusinessInfo(): Promise<BusinessInfo | null> {
|
||||||
|
|||||||
Reference in New Issue
Block a user