From f849601778a9aacb42a37952cb6578cc2d9d910a Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Fri, 28 Feb 2020 23:08:02 +0000 Subject: Allow category name to be independant of slug --- config.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'config.php') 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; }); }, ], -- cgit v1.2.3-13-gbd6f