1
0
Fork 0

[FIX] blog tag filter (function name collision)

This commit is contained in:
Jannik Beyerstedt 2021-01-30 23:47:05 +01:00
parent 2d714c2393
commit d61fd44ed1
3 changed files with 8 additions and 6 deletions

View file

@ -17,6 +17,6 @@ $a = $article;
</p> </p>
<div class="meta"> <div class="meta">
<time datetime="<?php echo $a->date()->toDate('Y-m-d') ?>"><?php echo $a->date()->toDate('d. M. Y') ?></time> <time datetime="<?php echo $a->date()->toDate('Y-m-d') ?>"><?php echo $a->date()->toDate('d. M. Y') ?></time>
<?php echo tags($base_url, $a); ?> <?php echo tags_html($base_url, $a); ?>
</div> </div>
</article> </article>

View file

@ -6,8 +6,8 @@
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License // license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
// ------------------------------------------- // -------------------------------------------
$base_url = $site->find('blog')->url(); // Function needed by blogexcerpt
function tags($base_url, $article) { function tags_html($base_url, $article) {
$tags = explode(',',(string)$article->tags()); $tags = explode(',',(string)$article->tags());
if (!empty($tags[0])) { if (!empty($tags[0])) {
@ -23,10 +23,12 @@ function tags($base_url, $article) {
} }
} }
$articles = $page->children()->listed()->flip();
$base_url = $site->find('blog')->url();
$articles = $page->children()->listed()->flip();
$title = $page->title()->html(); $title = $page->title()->html();
// Filter by requested tag
if($tag = param('tag')) { if($tag = param('tag')) {
$articles = $articles->filterBy('tags', $tag, ','); $articles = $articles->filterBy('tags', $tag, ',');
$title .= ' - '.$tag; $title .= ' - '.$tag;

View file

@ -7,7 +7,7 @@
// ------------------------------------------- // -------------------------------------------
$base_url = $site->find('blog')->url(); $base_url = $site->find('blog')->url();
function tags($base_url, $article) { function tags_html($base_url, $article) {
$tags = explode(',',(string)$article->tags()); $tags = explode(',',(string)$article->tags());
if (!empty($tags[0])) { if (!empty($tags[0])) {
@ -43,7 +43,7 @@ snippet('base/cont-header');
<div class="meta bottom"> <div class="meta bottom">
<time datetime="<?php echo $page->date()->toDate('Y-m-d') ?>"><?php echo $page->date()->toDate('d. M. Y') ?></time> <time datetime="<?php echo $page->date()->toDate('Y-m-d') ?>"><?php echo $page->date()->toDate('d. M. Y') ?></time>
<?php echo tags($base_url, $page); ?> <?php echo tags_html($base_url, $page); ?>
</div> </div>
</article> </article>