diff --git a/system/htmly.php b/system/htmly.php index a8ea9e3..6bc59e7 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -1417,6 +1417,55 @@ get('/:static', function ($static) { header("location: $login"); } die; + } elseif ($static === 'blog') { + + if(config('blog.enable') !== 'true') return not_found(); + + if (!login()) { + file_cache($_SERVER['REQUEST_URI']); + } + + $page = from($_GET, 'page'); + $page = $page ? (int)$page : 1; + $perpage = config('posts.perpage'); + + $posts = get_posts(null, $page, $perpage); + + $total = ''; + + $tl = blog_tagline(); + + if ($tl) { + $tagline = ' - ' . $tl; + } else { + $tagline = ''; + } + + if (empty($posts) || $page < 1) { + + // a non-existing page + render('no-posts', array( + 'title' => 'Blog - ' . blog_title(), + 'description' => blog_title() . ' Blog Homepage', + 'canonical' => site_url(), + 'bodyclass' => 'noposts', + 'is_front' => is_front(true), + )); + + die; + } + + render('main', array( + 'title' => 'Blog - ' . blog_title(), + 'description' => blog_title() . ' Blog Homepage', + 'canonical' => site_url() . 'blog', + 'page' => $page, + 'posts' => $posts, + 'bodyclass' => 'inblog', + 'breadcrumb' => '' . config('breadcrumb.home') . ' » Blog', + 'pagination' => has_pagination($total, $perpage, $page), + 'is_blog' => is_blog(true), + )); } else { if (config("views.counter") != "true") { @@ -1873,6 +1922,12 @@ get('/:year/:month/:name', function ($year, $month, $name) { else { $var = 'blogPost'; } + + if (config('blog.enable') === 'true') { + $blog = ' Blog » '; + } else { + $blog = ''; + } render('post', array( 'title' => $current->title . ' - ' . blog_title(), @@ -1881,7 +1936,7 @@ get('/:year/:month/:name', function ($year, $month, $name) { 'p' => $current, 'author' => $author, 'bodyclass' => 'inpost', - 'breadcrumb' => '' . config('breadcrumb.home') . ' » ' . $current->tagb . ' » ' . $current->title, + 'breadcrumb' => '' . config('breadcrumb.home') . ' » '. $blog . $current->tagb . ' » ' . $current->title, 'prev' => has_prev($prev), 'next' => has_next($next), 'type' => $var, @@ -2154,4 +2209,4 @@ get('.*', function () { }); // Serve the blog -dispatch(); +dispatch(); \ No newline at end of file diff --git a/system/includes/functions.php b/system/includes/functions.php index 105f9c5..8f9e1d0 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -1812,6 +1812,16 @@ function is_front($value = null) } } +// TRUE if the current page is the blog page. +function is_blog($value = null) +{ + if (!empty($value)) { + return true; + } else { + return false; + } +} + // TRUE if the current page is tag index. function is_tag($value = null) { diff --git a/themes/blog/css/styles.css b/themes/blog/css/styles.css index f0775cd..1fe3477 100644 --- a/themes/blog/css/styles.css +++ b/themes/blog/css/styles.css @@ -320,16 +320,13 @@ iframe { /* ======= Sections======= */ .sections-wrapper { padding-top: 60px; - padding-bottom: 60px; + padding-bottom: 30px; } .section { margin-bottom: 30px; } -.inpost.section, .inpage.section, .inprofile.section, .comment-wrapper.section, .tags.section, .section.last { - margin-bottom: 0px; -} .comment-wrapper.section { - margin-top:30px; + margin-bottom: 30px; } .section .section-inner { background: #fff; @@ -428,8 +425,11 @@ iframe { margin-bottom: 20px; } .pager { - margin-top:30px; - margin-bottom: 0px; + margin-top:0px; + margin-bottom: 30px; +} +.inprofile .pager { + margin-bottom:0px; } /* share section */ @@ -581,8 +581,8 @@ ul.month { float: none !important; } .sections-wrapper { - padding-bottom: 40px; - padding-top: 40px; + padding-top: 30px; + padding-bottom: 0px; } .project-image { margin-bottom: 15px; @@ -591,12 +591,6 @@ ul.month { float:none!important; text-align: center; } - .comment-wrapper.section { - margin-bottom:30px; - } - .pager { - margin-bottom: 30px; - } } /* Small devices (tablets, 768px and up) */ /* Medium devices (desktops, 992px and up) */