canina/frontend/application/app/page.tsx
parsa aghaei 70d58e7086
All checks were successful
Deploy Canina / deploy (push) Successful in 1m44s
feat(seo): unify dynamic SEO metadata and title formatting across backend, admin and application
2026-08-19 15:03:10 +03:30

36 lines
1003 B
TypeScript

import type { Metadata } from "next";
import HomeClient from "./HomeClient";
import { getPageMetadata } from "../lib/seo";
export async function generateMetadata(): Promise<Metadata> {
return getPageMetadata('home', {
canonicalPath: '/',
});
}
import { HomeApiResponse } from "../lib/types";
async function getHomeData(): Promise<HomeApiResponse | null> {
try {
const apiUrl = process.env.INTERNAL_API_URL || process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4001/api';
const res = await fetch(`${apiUrl}/home`, {
next: { revalidate: 3600, tags: ['home-data'] },
});
if (!res.ok) {
console.error(`Failed to fetch home data: ${res.status} ${res.statusText}`);
return null;
}
return await res.json();
} catch (error) {
console.error('Error fetching home data on server:', error);
return null;
}
}
export default async function Home() {
const initialData = await getHomeData();
return <HomeClient initialData={initialData} />;
}