diff --git a/src/app/[slug]/page.tsx b/src/app/[slug]/page.tsx new file mode 100644 index 0000000..eced62f --- /dev/null +++ b/src/app/[slug]/page.tsx @@ -0,0 +1,43 @@ +import React from "react"; +import { BlogData } from "@/utils/constant.utils"; +import BlogDetailsClient from "@/app/blog/[slug]/BlogDetailsClient"; +import { Metadata } from "next"; +import { notFound } from "next/navigation"; + +const blogs = BlogData; + +export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise { + const { slug } = await params; + const blog = blogs.find((b) => b.slug === slug); + + if (!blog) { + return { + title: "Blog Not Found", + }; + } + + return { + title: blog.metatitle || blog.title || "Blog Details", + description: blog.metaDisc || blog.description || "Read more on Metatroncube blog.", + alternates: { + canonical: `/${slug}`, + }, + }; +} + +export async function generateStaticParams() { + return blogs.map((blog) => ({ + slug: blog.slug, + })); +} + +export default async function BlogDetailsPage({ params }: { params: Promise<{ slug: string }> }) { + const { slug } = await params; + const blog = blogs.find((b) => b.slug === slug); + + if (!blog) { + notFound(); + } + + return ; +} diff --git a/src/app/blog/[slug]/page.tsx b/src/app/blog/[slug]/page.tsx index 634aac0..152d76a 100644 --- a/src/app/blog/[slug]/page.tsx +++ b/src/app/blog/[slug]/page.tsx @@ -1,32 +1,13 @@ -import React from "react"; +import { permanentRedirect } from "next/navigation"; import { BlogData } from "@/utils/constant.utils"; -import BlogDetailsClient from "./BlogDetailsClient"; -import { Metadata } from "next"; - -const blogs = BlogData; - -export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise { - const { slug } = await params; - const blog = blogs.find((b) => b.slug === slug); - - return { - title: blog?.metatitle || blog?.title || "Blog Details", - description: blog?.metaDisc || blog?.description || "Read more on Metatroncube blog.", - alternates: { - canonical: `/blog/${slug}`, - }, - }; -} export async function generateStaticParams() { - return blogs.map((blog) => ({ + return BlogData.map((blog) => ({ slug: blog.slug, })); } -export default async function BlogDetailsPage({ params }: { params: Promise<{ slug: string }> }) { +export default async function BlogDetailsRedirect({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; - const blog = blogs.find((b) => b.slug === slug); - - return ; + permanentRedirect(`/${slug}`); } diff --git a/src/components/blog/BlogSidebar.tsx b/src/components/blog/BlogSidebar.tsx index 92f6e56..af535c1 100644 --- a/src/components/blog/BlogSidebar.tsx +++ b/src/components/blog/BlogSidebar.tsx @@ -145,13 +145,13 @@ const BlogSidebar = ({ {recentPosts.map((post: any) => (
- + {post.title}
- {post.title} + {post.title}
{post.date} diff --git a/src/components/careers/CareersContactPopup.tsx b/src/components/careers/CareersContactPopup.tsx index 20062a3..96512cc 100644 --- a/src/components/careers/CareersContactPopup.tsx +++ b/src/components/careers/CareersContactPopup.tsx @@ -164,7 +164,7 @@ const CareersContactPopup: React.FC = ({ setAlert({ show: true, type: "success", - message: res?.data?.message || "Application submitted successfully!", + message: "Thank you! Your message has been sent successfully.", }); setFormData({ name: "", email: "", phone: "", position: defaultPosition, message: "" }); setResumeFile(null); diff --git a/src/components/careers/ContactSection.tsx b/src/components/careers/ContactSection.tsx index 265f39b..c6fbd69 100644 --- a/src/components/careers/ContactSection.tsx +++ b/src/components/careers/ContactSection.tsx @@ -94,7 +94,7 @@ const ContactSection = () => { setAlert({ show: true, type: "success", - message: res?.data?.message || "Message sent successfully!", + message: "Thank you! Your message has been sent successfully.", }); setFormData({ @@ -182,94 +182,94 @@ const ContactSection = () => { )}
-
- - - {formErrors.name && {formErrors.name}} -
-
- - - {formErrors.email && {formErrors.email}} -
-
- - - {formErrors.phone && {formErrors.phone}} -
-
- - - {formErrors.service && {formErrors.service}} -
-
- - - {formErrors.message && {formErrors.message}} -
- -
- - {formErrors.captcha && {formErrors.captcha}} -
- -
- -
+
+ + + {formErrors.name && {formErrors.name}}
+
+ + + {formErrors.email && {formErrors.email}} +
+
+ + + {formErrors.phone && {formErrors.phone}} +
+
+ + + {formErrors.service && {formErrors.service}} +
+
+ + + {formErrors.message && {formErrors.message}} +
+ +
+ + {formErrors.captcha && {formErrors.captcha}} +
+ +
+ +
+
diff --git a/src/components/careers/FaqVideoSection.tsx b/src/components/careers/FaqVideoSection.tsx index 2a854eb..97de915 100644 --- a/src/components/careers/FaqVideoSection.tsx +++ b/src/components/careers/FaqVideoSection.tsx @@ -56,7 +56,7 @@ const FaqVideoSection = () => { setAlert({ show: true, type: "success", - message: res?.data?.message || "Message sent successfully!", + message: "Thank you! Your message has been sent successfully.", }); setFormData({ name: "", phone: "", email: "", service: "", message: "" }); diff --git a/src/components/contact/ContactSection.tsx b/src/components/contact/ContactSection.tsx index 3a7a2f7..bfab63b 100644 --- a/src/components/contact/ContactSection.tsx +++ b/src/components/contact/ContactSection.tsx @@ -56,7 +56,7 @@ const ContactSection = () => { setAlert({ show: true, type: "success", - message: res?.data?.message || "Message sent successfully!", + message: "Thank you! Your message has been sent successfully.", }); setFormData({ diff --git a/src/components/home/HomeContactOne.tsx b/src/components/home/HomeContactOne.tsx index a993a63..50be4ae 100644 --- a/src/components/home/HomeContactOne.tsx +++ b/src/components/home/HomeContactOne.tsx @@ -56,7 +56,7 @@ const HomeContactOne = () => { setAlert({ show: true, type: "success", - message: res?.data?.message || "Message sent successfully!", + message: "Thank you! Your message has been sent successfully.", }); setFormData({ diff --git a/src/components/home/home-1/BlogSection.tsx b/src/components/home/home-1/BlogSection.tsx index 6ea004a..406aace 100644 --- a/src/components/home/home-1/BlogSection.tsx +++ b/src/components/home/home-1/BlogSection.tsx @@ -139,7 +139,7 @@ const BlogSection = ({ {currentBlogs.map((blog) => (
- + {blog.title} {blog.category} @@ -149,11 +149,11 @@ const BlogSection = ({ {blog.date}
- {blog.title} + {blog.title}
- + Learn More +
@@ -168,7 +168,7 @@ const BlogSection = ({ {currentBlogs.map((blog) => (
- + {blog.title} {blog.category} @@ -178,11 +178,11 @@ const BlogSection = ({ {blog.date}
- {blog.title} + {blog.title}
- + Learn More +