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

69 lines
2 KiB
PHP

<?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_html($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()->toDate('Y-m-d') ?>"><?php echo $page->date()->toDate('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()->toDate('Y-m-d') ?>"><?php echo $page->date()->toDate('d. M. Y') ?></time>
<?php echo tags_html($base_url, $page); ?>
</div>
</article>
<?php if($page->hasPrevListed() || $page->hasNextListed()): ?>
<div class="teasers">
<?php if($page->hasNextListed()) {
echo snippet('blogexcerpt',["article"=>$page->nextListed(),"length"=>200,"base_url"=>$base_url]);
} ?>
<?php if($page->hasPrevListed()) {
echo snippet('blogexcerpt',["article"=>$page->prevListed(),"length"=>200,"base_url"=>$base_url]);
} ?>
</div>
<?php endif ?>
</div>
</main>
<?php snippet('base/cont-footer') ?>
<?php snippet('base/html-end', ["plg_masonry"=>1]) ?>