From d61fd44ed1f06eba8e63e0f9129fbb54ef0b8154 Mon Sep 17 00:00:00 2001
From: Jannik Beyerstedt
Date: Sat, 30 Jan 2021 23:47:05 +0100
Subject: [PATCH] [FIX] blog tag filter (function name collision)
---
site/snippets/blogexcerpt.php | 2 +-
site/templates/blog.php | 8 +++++---
site/templates/blogarticle.php | 4 ++--
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/site/snippets/blogexcerpt.php b/site/snippets/blogexcerpt.php
index 32bbffb..43986a7 100644
--- a/site/snippets/blogexcerpt.php
+++ b/site/snippets/blogexcerpt.php
@@ -17,6 +17,6 @@ $a = $article;
-
+
diff --git a/site/templates/blog.php b/site/templates/blog.php
index 712f65b..1646d9f 100644
--- a/site/templates/blog.php
+++ b/site/templates/blog.php
@@ -6,8 +6,8 @@
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
// -------------------------------------------
-$base_url = $site->find('blog')->url();
-function tags($base_url, $article) {
+// Function needed by blogexcerpt
+function tags_html($base_url, $article) {
$tags = explode(',',(string)$article->tags());
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();
+// Filter by requested tag
if($tag = param('tag')) {
$articles = $articles->filterBy('tags', $tag, ',');
$title .= ' - '.$tag;
diff --git a/site/templates/blogarticle.php b/site/templates/blogarticle.php
index c23cb97..ae4c48c 100644
--- a/site/templates/blogarticle.php
+++ b/site/templates/blogarticle.php
@@ -7,7 +7,7 @@
// -------------------------------------------
$base_url = $site->find('blog')->url();
-function tags($base_url, $article) {
+function tags_html($base_url, $article) {
$tags = explode(',',(string)$article->tags());
if (!empty($tags[0])) {
@@ -43,7 +43,7 @@ snippet('base/cont-header');
-
+