diff options
| author | David T. Sadler <davidtsadler@googlemail.com> | 2020-02-28 23:08:02 +0000 |
|---|---|---|
| committer | David T. Sadler <davidtsadler@googlemail.com> | 2020-02-28 23:08:02 +0000 |
| commit | f849601778a9aacb42a37952cb6578cc2d9d910a (patch) | |
| tree | 4b897e30e78f1c583d2b72507d076d933e4fe08d /config.php | |
| parent | a95a53491467758c1fc0ebb3840b0e51a79b42f8 (diff) | |
Allow category name to be independant of slug
Diffstat (limited to 'config.php')
| -rw-r--r-- | config.php | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; }); }, ], |
