summaryrefslogtreecommitdiff
path: root/config.php
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2020-02-28 23:08:02 +0000
committerDavid T. Sadler <davidtsadler@googlemail.com>2020-02-28 23:08:02 +0000
commitf849601778a9aacb42a37952cb6578cc2d9d910a (patch)
tree4b897e30e78f1c583d2b72507d076d933e4fe08d /config.php
parenta95a53491467758c1fc0ebb3840b0e51a79b42f8 (diff)
Allow category name to be independant of slug
Diffstat (limited to 'config.php')
-rw-r--r--config.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/config.php b/config.php
index e357577..9c8274f 100644
--- a/config.php
+++ b/config.php
@@ -22,7 +22,10 @@ return [
'path' => '/categories/{filename}',
'posts' => function ($page, $allPosts) {
return $allPosts->filter(function ($post) use ($page) {
- return $post->categories ? in_array($page->getFilename(), $post->categories, true) : false;
+ $categorySlugs = array_map(function ($category) {
+ return Str::slug($category);
+ }, $post->categories);
+ return $post->categories ? in_array($page->getFilename(), $categorySlugs, true) : false;
});
},
],