blog slug updation and email result are updated
This commit is contained in:
parent
ffd1a8e5a0
commit
6cb852bdca
43
src/app/[slug]/page.tsx
Normal file
43
src/app/[slug]/page.tsx
Normal file
@ -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<Metadata> {
|
||||
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 <BlogDetailsClient blog={blog} />;
|
||||
}
|
||||
@ -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<Metadata> {
|
||||
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 <BlogDetailsClient blog={blog} />;
|
||||
permanentRedirect(`/${slug}`);
|
||||
}
|
||||
|
||||
@ -145,13 +145,13 @@ const BlogSidebar = ({
|
||||
{recentPosts.map((post: any) => (
|
||||
<div key={post.id} className="single-post-item">
|
||||
<div className="thumb bg-cover">
|
||||
<Link href={`/blog/${post.slug}`}>
|
||||
<Link href={`/${post.slug}`}>
|
||||
<img src={post.image} alt={post.title} />
|
||||
</Link>
|
||||
</div>
|
||||
<div className="post-content">
|
||||
<h5>
|
||||
<Link href={`/blog/${post.slug}`}>{post.title}</Link>
|
||||
<Link href={`/${post.slug}`}>{post.title}</Link>
|
||||
</h5>
|
||||
<div className="post-date">
|
||||
<i className="fa-regular fa-calendar"></i> {post.date}
|
||||
|
||||
@ -164,7 +164,7 @@ const CareersContactPopup: React.FC<CareersContactPopupProps> = ({
|
||||
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);
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -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: "" });
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -139,7 +139,7 @@ const BlogSection = ({
|
||||
{currentBlogs.map((blog) => (
|
||||
<div key={blog.id} className="blog-slider-item px-3">
|
||||
<div className="blog-style-one relative overflow-hidden">
|
||||
<Link className="blog-image w-img block relative" href={`/blog/${blog.slug}`}>
|
||||
<Link className="blog-image w-img block relative" href={`/${blog.slug}`}>
|
||||
<img src={blog.image} alt={blog.title} />
|
||||
<span className="blog-category-tag">{blog.category}</span>
|
||||
</Link>
|
||||
@ -149,11 +149,11 @@ const BlogSection = ({
|
||||
<span className="p-relative"><i className="fa-solid fa-calendar-days"></i> {blog.date}</span>
|
||||
</div>
|
||||
<h5 className="blog-title mb-20 mt-15">
|
||||
<Link href={`/blog/${blog.slug}`}>{blog.title}</Link>
|
||||
<Link href={`/${blog.slug}`}>{blog.title}</Link>
|
||||
</h5>
|
||||
<div className="blog-footer">
|
||||
<div className="blog-link-learn">
|
||||
<Link href={`/blog/${blog.slug}`} className="learn-more-link">
|
||||
<Link href={`/${blog.slug}`} className="learn-more-link">
|
||||
Learn More <span>+</span>
|
||||
</Link>
|
||||
</div>
|
||||
@ -168,7 +168,7 @@ const BlogSection = ({
|
||||
{currentBlogs.map((blog) => (
|
||||
<div key={blog.id} className={columns}>
|
||||
<div className="blog-style-one relative overflow-hidden">
|
||||
<Link className="blog-image w-img block relative" href={`/blog/${blog.slug}`}>
|
||||
<Link className="blog-image w-img block relative" href={`/${blog.slug}`}>
|
||||
<img src={blog.image} alt={blog.title} />
|
||||
<span className="blog-category-tag">{blog.category}</span>
|
||||
</Link>
|
||||
@ -178,11 +178,11 @@ const BlogSection = ({
|
||||
<span className="p-relative"><i className="fa-solid fa-calendar-days"></i> {blog.date}</span>
|
||||
</div>
|
||||
<h5 className="blog-title mb-20 mt-15">
|
||||
<Link href={`/blog/${blog.slug}`}>{blog.title}</Link>
|
||||
<Link href={`/${blog.slug}`}>{blog.title}</Link>
|
||||
</h5>
|
||||
<div className="blog-footer">
|
||||
<div className="blog-link-learn">
|
||||
<Link href={`/blog/${blog.slug}`} className="learn-more-link">
|
||||
<Link href={`/${blog.slug}`} className="learn-more-link">
|
||||
Learn More <span>+</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user