diff --git a/system/includes/functions.php b/system/includes/functions.php index 855bb5c..4dbf98e 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -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(); @@ -911,22 +911,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);