1
0
Fork 0
web-jbeyerstedt/site/templates/blogarticle.php

69 lines
2 KiB
PHP
Raw Normal View History

<?php
// -------------------------------------------
// kirby template FOR jannikbeyerstedt.de
// copyright: Jannik Beyerstedt | https://jannikbeyerstedt.de
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
// -------------------------------------------
$base_url = $site->find('blog')->url();
function tags($base_url, $article) {
$tags = explode(',',(string)$article->tags());
if (!empty($tags[0])) {
$return_val = '<span class="tags">';
foreach ($tags as $tag) {
$url = $base_url.'/tag:'.$tag;
$return_val .= '<a href="'.$url.'">' . $tag . '</a> ';
}
$return_val .= '</span>';
return $return_val;
} else {
return '';
}
}
snippet('blog-htmlhead');
snippet('base/cont-header');
?>
<main class="section blog">
<div class="container">
<article class="blogarticle">
<h1><?php echo $page->title()->html() ?></h1>
<div class="meta title">
<time datetime="<?php echo $page->date('Y-m-d') ?>"><?php echo $page->date('d. M. Y') ?></time>
</div>
<?php echo $page->text()->kirbytext(); ?>
<?php if ($page->en_masonry()->bool()) : echo snippet('plg/plg-masonry-sb', array('currentPage'=>$page)) ; endif;?>
<?php echo $page->text2()->kirbytext(); ?>
<div class="meta bottom">
<time datetime="<?php echo $page->date('Y-m-d') ?>"><?php echo $page->date('d. M. Y') ?></time>
<?php echo tags($base_url, $page); ?>
</div>
</article>
<?php if($page->hasPrevVisible() || $page->hasNextVisible()): ?>
<div class="teasers">
<?php if($page->hasNextVisible()) {
echo snippet('blogexcerpt',["article"=>$page->nextVisible(),"length"=>200,"base_url"=>$base_url]);
} ?>
<?php if($page->hasPrevVisible()) {
echo snippet('blogexcerpt',["article"=>$page->prevVisible(),"length"=>200,"base_url"=>$base_url]);
} ?>
</div>
<?php endif ?>
</div>
</main>
<?php snippet('base/cont-footer') ?>
<?php snippet('base/html-end', ["plg_masonry"=>1]) ?>