pagination and api blog metadata all page
This commit is contained in:
@@ -4,7 +4,17 @@ import AboutTopInfo from '@/components/pages/about/TopInfo';
|
||||
import { IPageParams } from '@/models/layout';
|
||||
import { setRequestLocale } from 'next-intl/server';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import Head from 'next/head';
|
||||
|
||||
export async function generateMetadata({ params }: { params: IPageParams }) {
|
||||
const { locale } = await params;
|
||||
setRequestLocale(locale);
|
||||
const t = await getTranslations({ locale });
|
||||
|
||||
return {
|
||||
title: t('page_about_metadata_title'),
|
||||
description: t('page_about_metadata_description'),
|
||||
};
|
||||
}
|
||||
|
||||
export default async function AboutUs({
|
||||
params,
|
||||
@@ -12,28 +22,16 @@ export default async function AboutUs({
|
||||
params: IPageParams;
|
||||
}>) {
|
||||
const { locale } = await params;
|
||||
|
||||
// Enable static rendering
|
||||
setRequestLocale(locale);
|
||||
|
||||
const t = await getTranslations({ locale });
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>درباره کارخانه آجرپزی پاسارگاد</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="معرفی کارخانه آجرپزی پاسارگاد، تاریخچه، چشمانداز، ظرفیت تولید و تیم متخصص ما."
|
||||
/>
|
||||
</Head>
|
||||
<main className="flex flex-col items-center justify-between">
|
||||
<InnerPageBanner
|
||||
title={t('pages_about_title')}
|
||||
imageSrc={images.aboutBanner.src}
|
||||
/>
|
||||
<AboutTopInfo />
|
||||
</main>
|
||||
</>
|
||||
<main className="flex flex-col items-center justify-between">
|
||||
<InnerPageBanner
|
||||
title={t('pages_about_title')}
|
||||
imageSrc={images.aboutBanner.src}
|
||||
/>
|
||||
<AboutTopInfo />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,30 +2,33 @@ import images from '@/assets/images/images';
|
||||
import InnerPageBanner from '@/components/layout/innerPages/banner';
|
||||
import PostsGrid from '@/components/pages/blog/PostsGrid';
|
||||
import { IPageParams } from '@/models/layout';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import Head from 'next/head';
|
||||
import { getPosts } from '@/services/blog';
|
||||
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
||||
|
||||
export async function generateMetadata({ params }: { params: IPageParams }) {
|
||||
const { locale } = await params;
|
||||
setRequestLocale(locale);
|
||||
const t = await getTranslations({ locale });
|
||||
|
||||
return {
|
||||
title: t('page_blog_metadata_title'),
|
||||
description: t('page_blog_metadata_description'),
|
||||
};
|
||||
}
|
||||
|
||||
export default async function Blog({ params }: { params: IPageParams }) {
|
||||
const paramsData = await params;
|
||||
const t = await getTranslations({ locale: paramsData.locale });
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>مقالات آموزشی درباره آجر و ساختوساز - پاسارگاد</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="مطالب تخصصی درباره آجر، نحوه انتخاب و کاربرد انواع آجر در ساختمانسازی و معماری."
|
||||
/>
|
||||
</Head>
|
||||
<main className="flex flex-col items-center justify-between">
|
||||
<InnerPageBanner
|
||||
title={t('pages_blog_title')}
|
||||
imageSrc={images.blogBanner.src}
|
||||
/>
|
||||
const { data: posts, pagination } = await getPosts();
|
||||
|
||||
<PostsGrid />
|
||||
</main>
|
||||
</>
|
||||
return (
|
||||
<main className="flex flex-col items-center justify-between">
|
||||
<InnerPageBanner
|
||||
title={t('pages_blog_title')}
|
||||
imageSrc={images.blogBanner.src}
|
||||
/>
|
||||
<PostsGrid initialPosts={posts} initialPagination={pagination} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,52 +4,54 @@ import ContactMap from '@/components/layout/map';
|
||||
import ContactForm from '@/components/pages/contact/ContactMeForm';
|
||||
import TouchUs from '@/components/pages/contact/TouchUs';
|
||||
import Image from 'next/image';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
||||
import { IPageParams } from '@/models/layout';
|
||||
import Head from 'next/head';
|
||||
|
||||
export async function generateMetadata({ params }: { params: IPageParams }) {
|
||||
const { locale } = await params;
|
||||
setRequestLocale(locale);
|
||||
const t = await getTranslations({ locale });
|
||||
|
||||
return {
|
||||
title: t('page_contact_metadata_title'),
|
||||
description: t('page_contact_metadata_description'),
|
||||
};
|
||||
}
|
||||
|
||||
export default async function Contact({ params }: { params: IPageParams }) {
|
||||
const { locale } = await params;
|
||||
|
||||
const t = await getTranslations({ locale });
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>تماس با کارخانه آجرپزی پاسارگاد</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="راههای ارتباطی با کارخانه آجرپزی پاسارگاد شامل شماره تلفن، آدرس، نقشه و فرم تماس آنلاین."
|
||||
/>
|
||||
</Head>
|
||||
<main className="flex flex-col items-center justify-between">
|
||||
<InnerPageBanner
|
||||
title={t('pages_contact_title')}
|
||||
imageSrc={images.blogBanner.src}
|
||||
/>
|
||||
<main className="flex flex-col items-center justify-between">
|
||||
<InnerPageBanner
|
||||
title={t('pages_contact_title')}
|
||||
imageSrc={images.blogBanner.src}
|
||||
/>
|
||||
|
||||
<div className="relative flex w-full flex-col bg-gray-200 pt-4 md:pt-28">
|
||||
<div className="absolute inset-x-0 inset-y-64 z-2 flex items-end justify-start">
|
||||
<div className="max-md:hidden md:w-1/2">
|
||||
<Image
|
||||
alt="footer-bg"
|
||||
src={images.factoryVector}
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="container mx-auto flex w-full flex-col items-stretch overflow-hidden rounded-lg md:flex-row">
|
||||
<TouchUs />
|
||||
<ContactForm />
|
||||
</div>
|
||||
|
||||
<div className="mt-4 w-full md:mt-28">
|
||||
<div className="h-64 w-full overflow-hidden rounded-lg bg-gray-200">
|
||||
<ContactMap />
|
||||
</div>
|
||||
<div className="relative flex w-full flex-col bg-gray-200 pt-4 md:pt-28">
|
||||
<div className="absolute inset-x-0 inset-y-64 z-2 flex items-end justify-start">
|
||||
<div className="max-md:hidden md:w-1/2">
|
||||
<Image
|
||||
alt="footer-bg"
|
||||
src={images.factoryVector}
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</>
|
||||
<div className="container mx-auto flex w-full flex-col items-stretch overflow-hidden rounded-lg md:flex-row">
|
||||
<TouchUs />
|
||||
<ContactForm />
|
||||
</div>
|
||||
|
||||
<div className="mt-4 w-full md:mt-28">
|
||||
<div className="h-64 w-full overflow-hidden rounded-lg bg-gray-200">
|
||||
<ContactMap />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,13 +4,23 @@ import HomeStorySection from '@/components/pages/home/HomeStorySection';
|
||||
import HomePageProducts from '@/components/pages/home/Products';
|
||||
import HomePageProjects from '@/components/pages/home/Projects';
|
||||
import type { IPageParams } from '@/models/layout.d';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
||||
|
||||
export async function generateMetadata({ params }: { params: IPageParams }) {
|
||||
const { locale } = await params;
|
||||
setRequestLocale(locale);
|
||||
const t = await getTranslations({ locale });
|
||||
|
||||
return {
|
||||
title: t('page_home_metadata_title'),
|
||||
description: t('page_home_metadata_description'),
|
||||
};
|
||||
}
|
||||
export default async function Home({ params }: { params: IPageParams }) {
|
||||
const { locale } = await params;
|
||||
|
||||
await getTranslations({ locale });
|
||||
|
||||
const t = await getTranslations({ locale });
|
||||
return (
|
||||
<main className="flex flex-col items-center justify-between">
|
||||
<Header />
|
||||
|
||||
@@ -7,18 +7,51 @@ import ProductCategoryCardInProducts from '@/components/pages/productCategories/
|
||||
import ProductList from '@/components/pages/products/productList';
|
||||
import { IPageParams } from '@/models/layout';
|
||||
import { getProductCategoryById, getProducts } from '@/services/products';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
||||
|
||||
interface IParams {
|
||||
product_category_id: string;
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: IPageParams<IParams>;
|
||||
}) {
|
||||
const { locale, product_category_id: productCategoryId } = await params;
|
||||
setRequestLocale(locale);
|
||||
const t = await getTranslations({ locale });
|
||||
|
||||
const productCategory = await getProductCategoryById(productCategoryId);
|
||||
|
||||
return {
|
||||
title: productCategory?.meta_title || t('page_products_metadata_title'),
|
||||
description:
|
||||
productCategory?.meta_description ||
|
||||
t('page_products_metadata_description'),
|
||||
keywords:
|
||||
productCategory?.meta_keywords || t('page_products_metadata_keywords'),
|
||||
alternates: {
|
||||
canonical: `https://your-domain.com/${locale}/products/${productCategory?.slug || productCategoryId}`,
|
||||
},
|
||||
openGraph: {
|
||||
title: productCategory?.meta_title || t('page_products_metadata_title'),
|
||||
description:
|
||||
productCategory?.meta_description ||
|
||||
t('page_products_metadata_description'),
|
||||
url: `https://your-domain.com/${locale}/products/${productCategory?.slug || productCategoryId}`,
|
||||
type: 'website',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default async function ProductPage({
|
||||
params,
|
||||
}: {
|
||||
params: IPageParams<IParams>;
|
||||
}) {
|
||||
const { product_category_id: productCategoryId, locale } = await params;
|
||||
setRequestLocale(locale);
|
||||
const t = await getTranslations({ locale });
|
||||
const routes = routeFactory(t, locale);
|
||||
|
||||
@@ -30,15 +63,13 @@ export default async function ProductPage({
|
||||
...routes.productCategories,
|
||||
href: routes.productCategories.route(),
|
||||
},
|
||||
{ title: productCategory.title },
|
||||
{ title: productCategory?.title || t('page_products_default_category') },
|
||||
] as IBreadcrumbItem[];
|
||||
|
||||
const refetch = () => {};
|
||||
|
||||
return (
|
||||
<main className="">
|
||||
<InnerPageBanner
|
||||
title={productCategory.title}
|
||||
title={productCategory?.title || t('page_products_default_title')}
|
||||
imageSrc={images.homeProductBack.src}
|
||||
/>
|
||||
<div className="container-fluid mx-auto my-24">
|
||||
|
||||
@@ -4,7 +4,18 @@ import ProductsCategoryCard from '@/components/pages/productCategories/ProductCa
|
||||
import type { IProductCategoryCardProps } from '@/components/pages/productCategories/productCategoryCard.d';
|
||||
import { IPageParams } from '@/models/layout';
|
||||
import { getProductCategories } from '@/services/products';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
||||
|
||||
export async function generateMetadata({ params }: { params: IPageParams }) {
|
||||
const { locale } = await params;
|
||||
setRequestLocale(locale);
|
||||
const t = await getTranslations({ locale });
|
||||
|
||||
return {
|
||||
title: t('page_products_metadata_title'),
|
||||
description: t('page_products_metadata_description'),
|
||||
};
|
||||
}
|
||||
|
||||
export default async function ProductsPage({
|
||||
params,
|
||||
|
||||
@@ -5,9 +5,19 @@ import ProjectsGrid from '@/components/pages/project/ProjectGrid';
|
||||
import ProjectsGridView from '@/components/pages/project/projectGridView';
|
||||
import { IPageParams } from '@/models/layout';
|
||||
import { getProjects } from '@/services/projects';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
||||
import Head from 'next/head';
|
||||
|
||||
export async function generateMetadata({ params }: { params: IPageParams }) {
|
||||
const { locale } = await params;
|
||||
setRequestLocale(locale);
|
||||
const t = await getTranslations({ locale });
|
||||
|
||||
return {
|
||||
title: t('page_projects_metadata_title'),
|
||||
description: t('page_projects_metadata_description'),
|
||||
};
|
||||
}
|
||||
export default async function ProjectsPage({
|
||||
params,
|
||||
}: {
|
||||
@@ -16,25 +26,15 @@ export default async function ProjectsPage({
|
||||
const { locale } = await params;
|
||||
const t = await getTranslations({ locale });
|
||||
const projects: IProjectCardProps[] = await getProjects();
|
||||
console.log(projects, 'proj');
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>پروژههای اجراشده با آجر پاسارگاد</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="نمونه پروژههای موفق اجراشده با آجرهای باکیفیت کارخانه آجرپزی پاسارگاد در سراسر کشور."
|
||||
/>
|
||||
</Head>
|
||||
<main>
|
||||
<InnerPageBanner
|
||||
title={t('pages_projects_title')}
|
||||
imageSrc={images.aboutBanner.src}
|
||||
/>
|
||||
<div className="container-fluid mx-auto my-24">
|
||||
<ProjectsGridView />
|
||||
</div>
|
||||
</main>
|
||||
</>
|
||||
<main>
|
||||
<InnerPageBanner
|
||||
title={t('pages_projects_title')}
|
||||
imageSrc={images.aboutBanner.src}
|
||||
/>
|
||||
<div className="container-fluid mx-auto my-24">
|
||||
<ProjectsGridView />
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user