From c9a12d334c21593f9d7eb0fd74f6e78d3166a4cc Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Sun, 8 Mar 2020 00:02:58 +0000 Subject: Style pagination --- config.php | 18 +++++++++--------- source/index.blade.php | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config.php b/config.php index 9c8274f..1626ba0 100644 --- a/config.php +++ b/config.php @@ -16,16 +16,16 @@ return [ // Default author, if not provided in a post 'author' => 'David T. Sadler', 'sort' => '-date', - 'path' => '/{filename}', + 'path' => '/posts/{date|Y-m-d}/{filename}', ], - 'categories' => [ - 'path' => '/categories/{filename}', + 'tags' => [ + 'path' => '/tags/{filename}', 'posts' => function ($page, $allPosts) { return $allPosts->filter(function ($post) use ($page) { - $categorySlugs = array_map(function ($category) { - return Str::slug($category); - }, $post->categories); - return $post->categories ? in_array($page->getFilename(), $categorySlugs, true) : false; + $tagSlugs = array_map(function ($tag) { + return Str::slug($tag); + }, $post->tags); + return $post->tags ? in_array($page->getFilename(), $tagSlugs, true) : false; }); }, ], @@ -36,7 +36,7 @@ return [ return Datetime::createFromFormat('U', $page->date); }, - 'allCategories' => function ($page, $allPosts) { - return $allPosts->pluck('categories')->flatten()->unique(); + 'allTags' => function ($page, $allPosts) { + return $allPosts->pluck('tags')->flatten()->unique()->sort(); }, ]; diff --git a/source/index.blade.php b/source/index.blade.php index e9b24e1..7097fdb 100644 --- a/source/index.blade.php +++ b/source/index.blade.php @@ -10,12 +10,12 @@ pagination: @include('_partials.postStub') @endforeach -