fix: update blog post URL handling to use API base URL instead of site URL

This commit is contained in:
Wini_Fy
2026-02-05 21:38:48 +07:00
parent 03263d5fb1
commit 0ae455f3d2
2 changed files with 5 additions and 8 deletions

View File

@@ -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);