테스트 사이트 - 개발 중인 베타 버전입니다

네이버 META 검색 잘 걸리게 하기 HOOK 기능

· 1년 전 · 2747 · 38

@다케미카코 님이 제작하신 네이버 META 검색 잘 걸리게 하기를 HOOK 기능을 만들어봤습니다.

https://sir.kr/yc5_tip/2326

 

[code]

// extend/user.extend.php 에 입력

 

if (! function_exists('common_header_shop_item_meta')) {
    add_event('common_header', 'common_header_shop_item_meta');
    function common_header_shop_item_meta() 
    {
        global $g5, $config;
        
        if($_REQUEST['it_id'] != "" && (!defined('G5_IS_ADMIN') || G5_IS_ADMIN == false)){
            $it_id = $_REQUEST['it_id'];
            $http_host = $_SERVER['HTTP_HOST'];
            $request_uri = $_SERVER['REQUEST_URI'];
            $ogUrl = 'https://' . $http_host . $request_uri;
            $sql = "select * from g5_shop_item where it_id='$it_id'";
            $item = sql_fetch($sql); // 쿼리 실행
            
            $ogType = 'website'; // default website
            $ogTitle = $g5['title'];        
            $ogImage = '';    // default image url 입력
               if ($item) {
                $ogTitle = $item['it_name'];                  
                $ogImage = get_it_imageurl($it_id);
            }
            
            $config['cf_add_meta'] .= '<meta property="og:url" content="'.$ogUrl.'" />';
            $config['cf_add_meta'] .= '<meta property="og:type" content="'.$ogType.'" />';
            $config['cf_add_meta'] .= '<meta property="og:title" content="'.$ogTitle.'"/>';
            $config['cf_add_meta'] .= '<meta property="og:image" content="'.$ogImage.'"/>';
        }
    }    
}

[/code]

 

이상 있으시면 댓글 남겨 주세요.

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 38개

오 쿨팁이네요!

1년 전

@coDribble 답변 감사합니다.^^

필요한 기능이었는데 감사합니다.

1년 전

@c5d2 유용하게 사용하시면 감사하겠습니다.^^ㅋ

1년 전

유용한 기능 나눠주셔서 감사합니다.

 

1년 전

@크리스휘 답변 감사합니다.

감사감사 유용한 기능 잘쓰겠습니다

1년 전

@미키손 답변 감사합니다.^^

구조화 데이타를 넣으세요. 네이버는 구조화 데이타가 가장 잘 적용되는것 같네요. 

1년 전

@솔그루 구조화 데이터 넣는 방법도 확인해서 올리겠습니다.^^

감사합니다.

게시글 목록

번호 제목
2400
2394
2363
2362
2351
2350
2348
2347
2336
2326
2324
2323
2318
2306
2305
2299
2295
2293
2283
2279
2266
2254
2248
2232
2231
2204
2184
2183
2181
2179