diff --git a/src/Roots/Acorn/Sage/Concerns/FiltersTemplates.php b/src/Roots/Acorn/Sage/Concerns/FiltersTemplates.php index f5055562..5cf425a5 100644 --- a/src/Roots/Acorn/Sage/Concerns/FiltersTemplates.php +++ b/src/Roots/Acorn/Sage/Concerns/FiltersTemplates.php @@ -2,6 +2,8 @@ namespace Roots\Acorn\Sage\Concerns; +use Illuminate\Support\Str; + trait FiltersTemplates { /** @@ -35,7 +37,12 @@ public function filterTemplateHierarchy($files) $templates = array_diff($templates, $pages); } - return [...$pages, ...$files, ...$templates]; + return collect([...$pages, ...$files, ...$templates]) + ->groupBy(function ($item) { + return Str::of($item)->afterLast('/')->before('.'); + }) + ->flatten() + ->toArray(); } /**