웹프로그래밍

Global It Leader!!


그누보드


 
 

메타태그 활용법

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 3,356회 작성일 19-10-15 08:08

본문

view페이지 내에 공유하기 용으로 한번 만들어봤습니다.

$wr_id  값이 있다는 가정하에,

 

 

/bbs/board.php에

약 179번째 라인 정도에

include_once(G5_PATH.'/head.sub.php');

소스 상단에

 

 

//첨부파일에서 뽑아내려면

$views = get_view($write, $board, $board_skin_path);

$meta_title = $views['wr_subject']; 

$meta_img = G5_DATA_URL.'/file/'.$bo_table.'/'.urlencode($views['file'][0]['file']);

$meta_description0 = strip_tags($views['wr_content']);

$meta_description = cut_str($meta_description0,100);

 

 

  

  

// 에디터에서 뽑아내려면

$views = get_view($write, $board, $board_skin_path);

$meta_title = $views['wr_subject'];

$matches = get_editor_image($views['wr_content']);

for ($i = 0; $i < count($matches[1]); $i++){

$img = $matches[1][$i];

preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img, $m); $src = $m[1];

}

$meta_img = $src;

$meta_description0 = strip_tags($views['wr_content']);

$meta_description = cut_str($meta_description0,100);

 넣어줍니다.

 

$views라고 한것은...

혹~~~~시나 뭔가 문제가 생길걸 대비해서...ㅎ

 

 

그리고

/head.sub.php 에

 


<? if($wr_id){ ?>

<meta name="title" content="title 적기" />

<meta name="author" content="author 적기" />

<meta name="keywords" content="태그들 적기" />

<meta name="description" content="<?=$meta_title;?>" />

<meta property="og:type" content="type 적기" />

<meta property="og:url" content="<?=G5_URL;?><?=$_SERVER['REQUEST_URI'];?>" />

<meta property="og:site_name" content="site_name 적기">

<meta property="og:title" content="<?=$meta_title;?>" />

<meta property="og:description" content="<?=$meta_description;?>" />

<meta property="og:image" content="<?=$meta_img;?>" />

<meta property="og:image:width" content="사이즈 적기">

<meta property="og:image:height" content="사이즈 적기">

<meta name="twitter:card" content="card 적기" />

<meta name="twitter:url" content="<?=G5_URL;?><?=$_SERVER['REQUEST_URI'];?>">

<meta name="twitter:title" content="<?=$meta_title;?>" />

<meta name="twitter:description" content="<?=$meta_description;?>" />

<meta name="twitter:image" content="<?=$meta_img;?>" />

<?}else{?>

어쩌고 저쩌고

<?}?>

 

요런식으로 해줍니다.

else부분안에는 태그들은 알아서 넣으시면됩니다 ㅎ

 

 

 

필요하신분들 잘 바꿔서 원하시는대로 쓰셨으면 좋겠네요.

댓글목록

등록된 댓글이 없습니다.

전체 59
게시물 검색
그누보드 목록
번호 제목 글쓴이 조회 날짜
39 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3988 03-26
38 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3965 01-31
37 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3948 11-15
36 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3939 07-16
35 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3917 11-29
34 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3796 06-14
33 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3761 02-21
32 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3713 08-20
31 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3695 07-21
30 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3684 12-25
29 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3629 03-13
28 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3597 05-06
27 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3550 04-15
열람중 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3357 10-15
25 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3071 11-06
24 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3039 10-21
23 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3008 10-21
22 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3002 02-23
21 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2891 06-14
20 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2682 02-03