From 0923f5dd10a47b304a4ead64bf8afbcd3c1a15cb Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 23 Aug 2025 00:17:09 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20title=20on=20kind=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bl-kernel/helpers/theme.class.php | 25 +++++++++++++++++++++++++ bl-kernel/site.class.php | 6 ++++++ bl-languages/en.json | 1 + bl-languages/fr_FR.json | 1 + 4 files changed, 33 insertions(+) diff --git a/bl-kernel/helpers/theme.class.php b/bl-kernel/helpers/theme.class.php index 11a83af3..085acaf0 100644 --- a/bl-kernel/helpers/theme.class.php +++ b/bl-kernel/helpers/theme.class.php @@ -143,6 +143,14 @@ class Theme } catch (Exception $e) { // Author doesn't exist } + } elseif ($WHERE_AM_I == 'kind') { + try { + $kindKey = $url->slug(); + $format = $site->titleFormatKind(); + return $L->get($kindKey); + } catch (Exception $e) { + // Kind doesn't exist + } } elseif ($WHERE_AM_I == 'home') { return $L->get("Latest articles"); } @@ -195,6 +203,14 @@ class Theme } catch (Exception $e) { // Author doesn't exist } + } elseif ($WHERE_AM_I == 'kind') { + try { + $kindKey = $url->slug(); + $format = $site->titleFormatKind(); + return $L->get('all-post-kind') . " " . $L->get($kindKey); + } catch (Exception $e) { + // Kind doesn't exist + } } elseif ($WHERE_AM_I == 'home') { return $L->get("all-post"); } @@ -221,6 +237,7 @@ class Theme global $categories; global $WHERE_AM_I; global $page; + global $L; if ($WHERE_AM_I == 'page') { $format = $site->titleFormatPages(); @@ -261,6 +278,14 @@ class Theme } catch (Exception $e) { // Author doesn't exist } + } elseif ($WHERE_AM_I == 'kind') { + try { + $kindKey = $url->slug(); + $format = $site->titleFormatKind(); + $format = Text::replace('{{kind-name}}', $L->get($kindKey), $format); + } catch (Exception $e) { + // Kind doesn't exist + } } else { $format = $site->titleFormatHomepage(); } diff --git a/bl-kernel/site.class.php b/bl-kernel/site.class.php index 022f126c..13906230 100644 --- a/bl-kernel/site.class.php +++ b/bl-kernel/site.class.php @@ -50,6 +50,7 @@ class Site extends dbJSON 'titleFormatTag' => '{{tag-name}} | {{site-title}}', 'titleFormatAuthor' => '{{author-name}} | {{site-title}}', 'titleFormatArchive' => '{{archive-name}} | {{site-title}}', + 'titleFormatKind' => '{{kind-name}} | {{site-title}}', 'imageRestrict' => true, 'imageRelativeToAbsolute' => false, 'thumbnailWidth' => 400, // px @@ -346,6 +347,11 @@ class Site extends dbJSON return $this->getField('titleFormatArchive'); } + public function titleFormatKind() + { + return $this->getField('titleFormatKind'); + } + public function titleFormatAuthor() { return $this->getField('titleFormatAuthor'); diff --git a/bl-languages/en.json b/bl-languages/en.json index aad959d8..94273e34 100644 --- a/bl-languages/en.json +++ b/bl-languages/en.json @@ -420,6 +420,7 @@ "all-post-tags": "All posts with the tag", "all-post-archive": "All posts written in", "all-post-author": "All posts written by", + "all-post-kind": "All posts using the following format :", "all-post": "All the latest posts written on the blog" } diff --git a/bl-languages/fr_FR.json b/bl-languages/fr_FR.json index 3bcdce49..7d08ceb4 100644 --- a/bl-languages/fr_FR.json +++ b/bl-languages/fr_FR.json @@ -431,5 +431,6 @@ "all-post-tags": "Tous les articles avec le tag", "all-post-archive": "Tous les articles écrits en", "all-post-author": "Tous les articles écrits par", + "all-post-kind": "Tous les post utilisant le format suivant :", "all-post": "Tout les articles écrits récemment sur le blog" } \ No newline at end of file