diff --git a/app/blog/[slug]/components/NewsDetailsContent.tsx b/app/blog/[slug]/components/NewsDetailsContent.tsx index dc915a8..11bf29d 100644 --- a/app/blog/[slug]/components/NewsDetailsContent.tsx +++ b/app/blog/[slug]/components/NewsDetailsContent.tsx @@ -12,12 +12,9 @@ export default function NewsDetailsContent({ post }: NewsDetailsContentProps) { // Lấy comments từ post (đã được bao gồm trong API response) const postComments = post.comments || []; - // Lấy base URL cho EditorJS images + // Lấy base URL cho EditorJS images và URL tuyệt đối của bài viết const baseUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001"; - - // URL tuyệt đối của bài viết để share lên mạng xã hội - const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || "http://localhost:3000"; - const postUrl = `${siteUrl}/blog/${post.slug}`; + const postUrl = `${baseUrl}/blog/${post.slug}`; const encodedPostUrl = encodeURIComponent(postUrl); const encodedTitle = encodeURIComponent(post.title); diff --git a/app/blog/[slug]/page.tsx b/app/blog/[slug]/page.tsx index 31ab061..10ea765 100644 --- a/app/blog/[slug]/page.tsx +++ b/app/blog/[slug]/page.tsx @@ -48,11 +48,11 @@ export async function generateMetadata({ const blogResponse = await fetchBlogDetail(slug); const post = blogResponse.data; - const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || "http://localhost:3000"; - const url = `${siteUrl}/blog/${post.slug}`; + const apiUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001"; + const url = `${apiUrl}/blog/${post.slug}`; const imageUrl = post.featuredImage ? getCmsImageUrl(post.featuredImage) - : `${siteUrl}/assets/img/inner-page/news-details/details-1.jpg`; + : `${apiUrl}/assets/img/inner-page/news-details/details-1.jpg`; return { title: post.title,