답변 1개
Copy
<head>
<?php
$default_image = "https://yourdomain.com/default-image.jpg"; // 게시글 이미지 없을시 기본 노출 이미지 URL
// 게시글 내용에서 이미지 추출
if (isset($view['file'][0]['path']) && isset($view['file'][0]['file'])) {
$post_image = $view['file'][0]['path'] . '/' . $view['file'][0]['file'];
}
// 최종 사용할 이미지 결정
$og_image = $post_image ? $post_image : $default_image;
?>
<!-- Open Graph Meta Tags -->
<meta property="og:title" content="<?php echo $view['wr_subject']; ?>" />
<meta property="og:description" content="<?php echo mb_substr(strip_tags($view['wr_content']), 0, 100); ?>" />
<meta property="og:image" content="<?php echo $og_image; ?>" />
<meta property="og:url" content="<?php echo $url; ?>" />
<meta property="og:type" content="article" />
</head>
답변을 작성하려면 로그인이 필요합니다.