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 ++++- source/_categories/mysql.md | 4 ++++ source/_categories/php.md | 4 ++++ source/_layouts/master.blade.php | 2 +- source/_partials/postStub.blade.php | 2 +- source/_posts/customizing-your-site.md | 2 +- source/_posts/getting-started.md | 2 +- 7 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 source/_categories/mysql.md create mode 100644 source/_categories/php.md 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; }); }, ], diff --git a/source/_categories/mysql.md b/source/_categories/mysql.md new file mode 100644 index 0000000..9d40511 --- /dev/null +++ b/source/_categories/mysql.md @@ -0,0 +1,4 @@ +--- +extends: _layouts.category +description: All the MySql posts +--- diff --git a/source/_categories/php.md b/source/_categories/php.md new file mode 100644 index 0000000..7efa7fd --- /dev/null +++ b/source/_categories/php.md @@ -0,0 +1,4 @@ +--- +extends: _layouts.category +description: All the PHP posts +--- diff --git a/source/_layouts/master.blade.php b/source/_layouts/master.blade.php index 429c4a7..05402f8 100644 --- a/source/_layouts/master.blade.php +++ b/source/_layouts/master.blade.php @@ -9,7 +9,7 @@ diff --git a/source/_partials/postStub.blade.php b/source/_partials/postStub.blade.php index ca9f08b..734d23f 100644 --- a/source/_partials/postStub.blade.php +++ b/source/_partials/postStub.blade.php @@ -9,7 +9,7 @@
@foreach ($post->categories as $category) - {{ $category }} + {{ $category }} @endforeach
diff --git a/source/_posts/customizing-your-site.md b/source/_posts/customizing-your-site.md index 50b53a1..aaf2850 100644 --- a/source/_posts/customizing-your-site.md +++ b/source/_posts/customizing-your-site.md @@ -4,7 +4,7 @@ section: content title: Customizing Your Site date: 2018-12-24 description: Customize your site with CSS and JS -categories: [configuration, feature] +categories: [PHP, MySQL] featured: true excerpt: This starter template comes pre-loaded with Tailwind CSS, a utility CSS framework that allows you to customize and build complex designs without touching a line of CSS. --- diff --git a/source/_posts/getting-started.md b/source/_posts/getting-started.md index 8f28cc6..1b378a9 100644 --- a/source/_posts/getting-started.md +++ b/source/_posts/getting-started.md @@ -6,7 +6,7 @@ date: 2018-12-25 description: Getting started with the Jigsaw blog starter template cover_image: /assets/img/post-cover-image-2.png featured: true -categories: [configuration] +categories: [Configuration] --- This is a starter template for creating a beautiful, customizable blog with minimal effort. You’ll only have to change a few settings and you’re ready to go. -- cgit v1.2.3-13-gbd6f