From 34603e39892d01ad8c33ae8f3e94048ec32681ec Mon Sep 17 00:00:00 2001 From: Danang Probo Sayekti Date: Thu, 30 Jan 2014 21:55:35 +0700 Subject: [PATCH] Handle sitemap error handle sitemap error when no content available. --- system/htmly.php | 12 ++++++------ system/includes/functions.php | 20 ++++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/system/htmly.php b/system/htmly.php index 36261a4..9605061 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -294,13 +294,13 @@ get('/admin/posts', function(){ if(empty($posts) || $page < 1){ render('posts-list',array( - 'title' => 'Profile for: '. $bio->title .' - ' . config('blog.title'), + 'title' => 'All posts by: '. $bio->title .' - ' . config('blog.title'), 'page' => $page, 'posts' => null, 'bio' => $bio->body, 'name' => $bio->title, - 'canonical' => config('site.url') . '/author/' . $profile, - 'description' => 'Profile page and all posts by ' . $bio->title . ' on ' . config('blog.title') . '.', + 'canonical' => config('site.url') . '/admin/posts', + 'description' => 'All posts by ' . $bio->title . ' on ' . config('blog.title') . '.', 'bodyclass' => 'userposts', 'breadcrumb' => '' .config('breadcrumb.home'). ' » Profile for: ' . $bio->title, 'pagination' => has_pagination($total, $perpage, $page) @@ -309,13 +309,13 @@ get('/admin/posts', function(){ } render('posts-list',array( - 'title' => 'Profile for: '. $bio->title .' - ' . config('blog.title'), + 'title' => 'All posts by: '. $bio->title .' - ' . config('blog.title'), 'page' => $page, 'posts' => $posts, 'bio' => $bio->body, 'name' => $bio->title, - 'canonical' => config('site.url') . '/author/' . $profile, - 'description' => 'Profile page and all posts by ' . $bio->title . ' on ' . config('blog.title') . '.', + 'canonical' => config('site.url') . '/admin/posts', + 'description' => 'All posts by ' . $bio->title . ' on ' . config('blog.title') . '.', 'bodyclass' => 'userposts', 'breadcrumb' => '' .config('breadcrumb.home'). ' » Profile for: ' . $bio->title, 'pagination' => has_pagination($total, $perpage, $page) diff --git a/system/includes/functions.php b/system/includes/functions.php index 917a8c8..12885a7 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -305,9 +305,9 @@ function get_bio($author){ $names = get_author_names(); + $tmp = array(); + if(!empty($names)) { - - $tmp = array(); foreach($names as $index => $v){ $post = new stdClass; @@ -341,9 +341,9 @@ function get_bio($author){ $tmp[] = $post; } } - - return $tmp; } + return $tmp; + } function default_profile($author) { @@ -1091,12 +1091,16 @@ function generate_sitemap($str){ $tag[] = site_url() . 'tag/' . $t; } - $tag = array_unique($tag, SORT_REGULAR); - echo ''; - foreach($tag as $t) { - echo '' . $t . 'weekly0.5'; + if(isset($tag)) { + + $tag = array_unique($tag, SORT_REGULAR); + + foreach($tag as $t) { + echo '' . $t . 'weekly0.5'; + } + } echo '';