forked from UKSOURCE/hailearning.edu.vn
fix: update blog post URL handling to use API base URL instead of site URL
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user