From 05feeecd170303eab77a30f9e00d7df694b66669 Mon Sep 17 00:00:00 2001 From: Yash Khare Date: Wed, 4 Dec 2024 16:19:21 +0530 Subject: [PATCH 1/2] feat: meta tags for blogs Signed-off-by: Yash Khare --- lib/api.ts | 12 ++++++++++++ pages/community/[slug].tsx | 5 ++--- pages/technology/[slug].tsx | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/api.ts b/lib/api.ts index 17e5494..e2b1943 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -300,6 +300,10 @@ export async function getAllPostsForTechnology(preview) { } } } + seo { + metaDesc + title + } } } } @@ -355,6 +359,10 @@ export async function getAllPostsForCommunity(preview) { } } } + seo { + metaDesc + title + } } } pageInfo { @@ -585,6 +593,10 @@ export async function getPostAndMorePosts(slug, preview, previewData) { } } } + seo{ + metaDesc + title + } } query PostBySlug($id: ID!, $idType: PostIdType!) { post(id: $id, idType: $idType) { diff --git a/pages/community/[slug].tsx b/pages/community/[slug].tsx index a685435..b0c6c2e 100644 --- a/pages/community/[slug].tsx +++ b/pages/community/[slug].tsx @@ -104,7 +104,6 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { if (post && post.content) { const content = post.content; - const avatarDivMatch = content.match( /]*class="pp-author-boxes-avatar"[^>]*>\s*]*src='([^']*)'[^>]*\/?>/ ); @@ -146,8 +145,8 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) {
diff --git a/pages/technology/[slug].tsx b/pages/technology/[slug].tsx index a3698a6..a95a9df 100644 --- a/pages/technology/[slug].tsx +++ b/pages/technology/[slug].tsx @@ -135,8 +135,8 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) {
From 96819db98bf3195f733d88c37c4efdf37ab03947 Mon Sep 17 00:00:00 2001 From: Animesh Pathak Date: Tue, 10 Dec 2024 13:24:36 +0530 Subject: [PATCH 2/2] fix: fallBack for MetaData Signed-off-by: Animesh Pathak --- pages/community/[slug].tsx | 4 ++-- pages/technology/[slug].tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/community/[slug].tsx b/pages/community/[slug].tsx index 1a5e8fa..bc7ba53 100644 --- a/pages/community/[slug].tsx +++ b/pages/community/[slug].tsx @@ -116,7 +116,7 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { // Match the

with class pp-author-boxes-description and extract its content const authorDescriptionMatch = content.match( - /]*class="pp-author-boxes-description multiple-authors-description"[^>]*>(.*?)<\/p>/s + /]*class="pp-author-boxes-description multiple-authors-description"[^>]*>(.*?)<\/p>/ ); // Apply table responsive wrapper @@ -146,7 +146,7 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { preview={preview} featuredImage={post?.featuredImage?.node?.sourceUrl || ""} Title={post?.seo.title || "Loading..."} - Description={`${post?.seo.metaDesc || "Blog About Keploy"}`} + Description={`${post?.seo.metaDesc || "Blog About " + `${post?.title}`}`} >

diff --git a/pages/technology/[slug].tsx b/pages/technology/[slug].tsx index 518f063..f449663 100644 --- a/pages/technology/[slug].tsx +++ b/pages/technology/[slug].tsx @@ -111,7 +111,7 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { // Match the

with class pp-author-boxes-description and extract its content const authorDescriptionMatch = content.match( - /]*class="pp-author-boxes-description multiple-authors-description"[^>]*>(.*?)<\/p>/s + /]*class="pp-author-boxes-description multiple-authors-description"[^>]*>(.*?)<\/p>/ ); if ( @@ -136,7 +136,7 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { preview={preview} featuredImage={post?.featuredImage?.node?.sourceUrl || ""} Title={post?.seo.title || "Loading..."} - Description={`${post?.seo.metaDesc || "Blog About Keploy"}`} + Description={`${post?.seo.metaDesc || "Blog About " + `${post?.title}`}`} >