Sitemap problems

Fix sitemap problems.
This commit is contained in:
Danang Probo Sayekti 2014-01-22 20:45:36 +07:00
commit 521f44df0a

View file

@ -872,7 +872,7 @@ function generate_rss($posts){
echo $feed;
}
// Return post, tag, archive url.
// Return post, archive url.
function get_path(){
$posts = get_post_sorted();
@ -912,22 +912,6 @@ function get_path(){
// The post URL
$post->url = site_url().date('Y/m', $post->date).'/'.str_replace('.md','',$arr[2]);
$tag = array();
$url = array();
$t = explode(',', $arr[1]);
foreach($t as $tt) {
$tag[] = array($tt, site_url(). 'tag/' . $tt);
}
foreach($tag as $a) {
$url[] = $a[1];
}
$post->tag = implode(', ', $url);
$post->tagb = implode(' » ', $url);
$tmp[] = $post;
}
@ -1011,11 +995,23 @@ function generate_sitemap($str){
}
elseif ($str == 'tag') {
$posts = get_path();
$tag = array();
$posts = get_post_unsorted();
$tags = array();
foreach($posts as $p) {
$tag[] = $p->tag;
foreach($posts as $index => $v){
$arr = explode('_', $v);
$data = $arr[1];
$mtag = explode(',', $data);
foreach($mtag as $etag) {
$tags[] = $etag;
}
}
foreach($tags as $t) {
$tag[] = site_url() . 'tag/' . $t;
}
$tag = array_unique($tag, SORT_REGULAR);