Browse Source

Handle sitemap error

handle sitemap error when no content available.
pull/31/merge
Danang Probo Sayekti 12 years ago
parent
commit
34603e3989
2 changed files with 18 additions and 14 deletions
  1. +6
    -6
      system/htmly.php
  2. +12
    -8
      system/includes/functions.php

+ 6
- 6
system/htmly.php View File

@ -294,13 +294,13 @@ get('/admin/posts', function(){
if(empty($posts) || $page < 1){ if(empty($posts) || $page < 1){
render('posts-list',array( render('posts-list',array(
'title' => 'Profile for: '. $bio->title .' - ' . config('blog.title'),
'title' => 'All posts by: '. $bio->title .' - ' . config('blog.title'),
'page' => $page, 'page' => $page,
'posts' => null, 'posts' => null,
'bio' => $bio->body, 'bio' => $bio->body,
'name' => $bio->title, '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', 'bodyclass' => 'userposts',
'breadcrumb' => '<a href="' . config('site.url') . '">' .config('breadcrumb.home'). '</a> &#187; Profile for: ' . $bio->title, 'breadcrumb' => '<a href="' . config('site.url') . '">' .config('breadcrumb.home'). '</a> &#187; Profile for: ' . $bio->title,
'pagination' => has_pagination($total, $perpage, $page) 'pagination' => has_pagination($total, $perpage, $page)
@ -309,13 +309,13 @@ get('/admin/posts', function(){
} }
render('posts-list',array( render('posts-list',array(
'title' => 'Profile for: '. $bio->title .' - ' . config('blog.title'),
'title' => 'All posts by: '. $bio->title .' - ' . config('blog.title'),
'page' => $page, 'page' => $page,
'posts' => $posts, 'posts' => $posts,
'bio' => $bio->body, 'bio' => $bio->body,
'name' => $bio->title, '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', 'bodyclass' => 'userposts',
'breadcrumb' => '<a href="' . config('site.url') . '">' .config('breadcrumb.home'). '</a> &#187; Profile for: ' . $bio->title, 'breadcrumb' => '<a href="' . config('site.url') . '">' .config('breadcrumb.home'). '</a> &#187; Profile for: ' . $bio->title,
'pagination' => has_pagination($total, $perpage, $page) 'pagination' => has_pagination($total, $perpage, $page)


+ 12
- 8
system/includes/functions.php View File

@ -305,9 +305,9 @@ function get_bio($author){
$names = get_author_names(); $names = get_author_names();
$tmp = array();
if(!empty($names)) { if(!empty($names)) {
$tmp = array();
foreach($names as $index => $v){ foreach($names as $index => $v){
$post = new stdClass; $post = new stdClass;
@ -341,9 +341,9 @@ function get_bio($author){
$tmp[] = $post; $tmp[] = $post;
} }
} }
return $tmp;
} }
return $tmp;
} }
function default_profile($author) { function default_profile($author) {
@ -1091,12 +1091,16 @@ function generate_sitemap($str){
$tag[] = site_url() . 'tag/' . $t; $tag[] = site_url() . 'tag/' . $t;
} }
$tag = array_unique($tag, SORT_REGULAR);
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach($tag as $t) {
echo '<url><loc>' . $t . '</loc><changefreq>weekly</changefreq><priority>0.5</priority></url>';
if(isset($tag)) {
$tag = array_unique($tag, SORT_REGULAR);
foreach($tag as $t) {
echo '<url><loc>' . $t . '</loc><changefreq>weekly</changefreq><priority>0.5</priority></url>';
}
} }
echo '</urlset>'; echo '</urlset>';


Loading…
Cancel
Save