/extend/user.config.php 파일에 아래 내용 추가해 주세요.
/**
* 게시물, 상품별 검색차단 함수
*
* @return void
*/
function check_noindex_meta()
{
global $g5, $bo_table, $wr_id, $it_id;
// 게시판 글 체크
if (isset($bo_table) && isset($wr_id)) {
$bo_table_safe = preg_replace('/[^a-z0-9_]/i', '', $bo_table);
$wr_id_safe = (int)$wr_id;
if ($bo_table_safe && $wr_id_safe) {
$sql = "SELECT wr_10 FROM {$g5['write_prefix']}{$bo_table_safe} WHERE wr_id = '{$wr_id_safe}'";
$row = sql_fetch($sql);
if ($row && !empty($row['wr_10']) && strpos($row['wr_10'], '검색차단') !== false) {
echo '<meta name="robots" content="noindex, nofollow">' . "\n";
return true;
}
}
}
// 영카트 상품 체크
if (isset($it_id)) {
$it_id_safe = preg_replace('/[^a-z0-9_-]/i', '', $it_id);
if ($it_id_safe) {
$sql = "SELECT it_10 FROM {$g5['g5_shop_item_table']} WHERE it_id = '{$it_id_safe}'";
$row = sql_fetch($sql);
if ($row && !empty($row['it_10']) && strpos($row['it_10'], '검색차단') !== false) {
echo '<meta name="robots" content="noindex, nofollow">' . "\n";
return true;
}
}
}
return false;
}
사용중인 head.sub.php 파일에 아래 내용 추가합니다.
상단에 <meta charset="utf-8"> 태그 아래에 추가해 주세요.
<?php check_noindex_meta(); ?>
게시물 수정에서 여분 필드 10번인 wr_10 에 검색차단 입력하면 해당 게시물은 검색 차단용 메타태그를 출력합니다.
영카트는 상품 수정에 여분필드 10번 it_10 에 검색차단 이라고 입력하면 됩니다.
게시판 여분필드 사용법은 SIR 많이 있습니다.
여분필드 바꾸고 싶다면 함수의 wr_10, it_10을 원하는 여분필드로 바꾸세요.