dev #22
@ -24,7 +24,7 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
|
|||||||
if (!!blog) {
|
if (!!blog) {
|
||||||
// check for blog data
|
// check for blog data
|
||||||
title = `${!!blog.data?.meta?.title ? blog.data?.meta?.title : blog.data.title} - ${name}`;
|
title = `${!!blog.data?.meta?.title ? blog.data?.meta?.title : blog.data.title} - ${name}`;
|
||||||
description = `${!!blog.data?.meta?.description ? blog.data?.meta?.description : blog.data.title} - ${name}`;
|
description = `${!!blog.data?.meta?.description ? blog.data?.meta?.description : blog.data.title}`;
|
||||||
imgUrl = blog.imgUrl;
|
imgUrl = blog.imgUrl;
|
||||||
publishedAt = blog.data.createdAt;
|
publishedAt = blog.data.createdAt;
|
||||||
updatedAt = blog.data.updatedAt;
|
updatedAt = blog.data.updatedAt;
|
||||||
@ -39,7 +39,7 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
|
|||||||
const page = await fetchPageBySlug({ slug });
|
const page = await fetchPageBySlug({ slug });
|
||||||
if (!!page) {
|
if (!!page) {
|
||||||
title = `${!!page?.meta?.title ? page?.meta?.title : page.title} - ${name}`;
|
title = `${!!page?.meta?.title ? page?.meta?.title : page.title} - ${name}`;
|
||||||
description = `${!!page?.meta?.description ? page?.meta?.description : page.title} - ${name}`;
|
description = `${!!page?.meta?.description ? page?.meta?.description : page.title}`;
|
||||||
imgUrl = page.heroImg?.url;
|
imgUrl = page.heroImg?.url;
|
||||||
publishedAt = page.createdAt;
|
publishedAt = page.createdAt;
|
||||||
updatedAt = page.updatedAt;
|
updatedAt = page.updatedAt;
|
||||||
|
@ -22,8 +22,8 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
|
|||||||
|
|
||||||
// check for blog data
|
// check for blog data
|
||||||
if (!!team) {
|
if (!!team) {
|
||||||
title = !!team.data.meta?.title ? team.data.meta?.title : `${team.data.name} - ${name}`;
|
title = `${!!team.data?.meta?.title ? team.data?.meta?.title : team.data.name} - ${name}`;
|
||||||
description = !!team.data.meta?.description ? team.data.meta?.description : description;
|
description = !!team.data.meta?.description ? team.data.meta?.description : team.data.name;
|
||||||
imgUrl = team.imgUrl;
|
imgUrl = team.imgUrl;
|
||||||
if (!!team?.data?.meta?.canonical_url) {
|
if (!!team?.data?.meta?.canonical_url) {
|
||||||
canonicalUrl = team.data.meta.canonical_url;
|
canonicalUrl = team.data.meta.canonical_url;
|
||||||
|
@ -21,7 +21,8 @@ export function middleware(request: NextRequest) {
|
|||||||
|
|
||||||
// redirect for /blog/<slug>/ path
|
// redirect for /blog/<slug>/ path
|
||||||
const blogPathRegex = /^\/blog\/([^\/]+)(\/[^\/]*)*\/?$/;
|
const blogPathRegex = /^\/blog\/([^\/]+)(\/[^\/]*)*\/?$/;
|
||||||
if (blogPathRegex.test(path)) {
|
console.log("path", blogPathRegex.test(path) && !path.includes("/blog/?"));
|
||||||
|
if (blogPathRegex.test(path) && !path.includes("/blog/?")) {
|
||||||
const newBlogPath = path.replace(/^\/blog/, "") || "/";
|
const newBlogPath = path.replace(/^\/blog/, "") || "/";
|
||||||
return NextResponse.redirect(`${mainUrl}${newBlogPath}`, 301);
|
return NextResponse.redirect(`${mainUrl}${newBlogPath}`, 301);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user