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

69 lines
2 KiB
PHP
Raw Permalink 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_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">
2021-01-24 17:05:39 +00:00
<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(); ?>
2021-01-24 17:05:39 +00:00
<?php if ($page->en_masonry()->bool()) : echo snippet('plg/plg-masonry-sb', array('currentPage'=>$page)) ; endif;?>
2021-01-24 17:05:39 +00:00
<?php echo $page->text2()->kirbytext(); ?>
2021-01-24 17:05:39 +00:00
<div class="meta bottom">
2021-01-24 17:05:39 +00:00
<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>
2021-01-24 17:05:39 +00:00
<?php if($page->hasPrevListed() || $page->hasNextListed()): ?>
<div class="teasers">
2021-01-24 17:05:39 +00:00
<?php if($page->hasNextListed()) {
echo snippet('blogexcerpt',["article"=>$page->nextListed(),"length"=>200,"base_url"=>$base_url]);
} ?>
2021-01-24 17:05:39 +00:00
<?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]) ?>