사이트맵이랑 rss 어떻게해야하나요>?
본문
ㅜㅜ 아무리봐도모르겟음요 좀도와주세용
답변 2
<?php
include_once "_common.php";
header("Content-type: text/xml;charset=utf-8");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
$limit = 100; // feed 생성 수
$buff = '';
$buff .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>".PHP_EOL;
$buff .= '<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:activity="http://activitystrea.ms/spec/1.0/" >'.PHP_EOL;
$buff .= '<channel>'.PHP_EOL;
$buff .= '<title><![CDATA['.$config['cf_title'].']]></title>'.PHP_EOL;
$buff .= '<link>http://kbsba.kr</link>'.PHP_EOL;
$buff .= '<description><![CDATA['.$config['cf_1'].']]></description>'.PHP_EOL;
$buff .= '<language>ko</language>'.PHP_EOL;
$Search = " where (1) ";
$Search .= " and wr_is_comment = 0 ";
$SelectBoard = " select bo_table,bo_subject from ".$g5['board_table']." where bo_use_search = 1 ";
$QueryBoard = sql_query($SelectBoard);
while($RowBoard = sql_fetch_array($QueryBoard)){ $ResultSelect[] = "( select *, '".$RowBoard['bo_table']."' as bo_table from ".$g5['write_prefix'].$RowBoard['bo_table'].$Search." )"; }
$ResultQuery = implode(" union all ", $ResultSelect);
$ResultQuery .= " order by wr_datetime desc limit 0 , $limit ";
$Query = sql_query($ResultQuery);
while($Row = sql_fetch_array($Query)){
$content = strip_tags($Row['wr_content']);
$content = str_replace(" "," ",$content);
$board = sql_fetch("select bo_subject from g5_board where bo_table = '".$Row['bo_table']."'");
$buff .= "<item>".PHP_EOL;
$buff .= "<category><![CDATA[".$board['bo_subject']."]]></category>".PHP_EOL;
$buff .= "<title><![CDATA[".$Row['bo_subject']." - ".$Row['wr_subject']."]]></title>".PHP_EOL;
$buff .= "<link>".G5_BBS_URL."/board.php?bo_table=".$Row['bo_table']."&wr_id=".$Row['wr_id']."</link>".PHP_EOL;
$buff .= "<description><![CDATA[".mb_strimwidth($content,0,400,'..','utf-8')."]]></description>".PHP_EOL;
$buff .= "<author>".$Row['wr_name']."</author>".PHP_EOL;
$buff .= "<pubDate>".date("D, d M Y H:i:s T", strtotime($Row['wr_datetime']))."</pubDate>".PHP_EOL;
$buff .= "</item>".PHP_EOL;
}
$buff .= "</channel>".PHP_EOL;
$buff .= "</rss>";
echo $buff;
?>
rss는 게시판 셋팅구간에서 rss허용 누르신 다음에 /bbs/board.php를 /bbs/rss.php
sitemap의 경우
https://seo.tbwakorea.com/blog/how-to-create-and-submit-a-sitemap/
이런거 참고해보시면 되요