Skip to content

Commit 927fe66

Browse files
committed
Fix #350, Use the model path properties
1 parent 566329d commit 927fe66

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/Actions/GeneratesNavigationMenu.php

+4-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Hyde\Framework\Features;
66
use Hyde\Framework\Hyde;
7+
use Hyde\Framework\Models\DocumentationPage;
78
use Hyde\Framework\Services\CollectionService;
89
use Illuminate\Support\Str;
910
use JetBrains\PhpStorm\Pure;
@@ -78,12 +79,12 @@ private function getLinks(): array
7879
// And there is no link to the docs...
7980
if (! in_array('Docs', array_column($links, 'title'))) {
8081
// But a suitable file exists...
81-
if (file_exists('_docs/index.md') || file_exists('_docs/readme.md')) {
82+
if (file_exists(DocumentationPage::$sourceDirectory.'/index.md') || file_exists(DocumentationPage::$sourceDirectory.'/readme.md')) {
8283
// Then we can add a link.
8384
$links[] = [
8485
'title' => 'Docs',
8586
'route' => $this->getRelativeRoutePathForSlug(
86-
file_exists('_docs/index.md')
87+
file_exists(DocumentationPage::$sourceDirectory.'/index.md')
8788
? Hyde::docsDirectory().'/index'
8889
: Hyde::docsDirectory().'/readme'
8990
),
@@ -157,15 +158,9 @@ public function getTitleFromSlug(string $slug): string
157158
#[Pure]
158159
private function getListOfCustomPages(): array
159160
{
160-
$array = [];
161-
162-
foreach (glob(Hyde::path('_pages/*.blade.php')) as $path) {
163-
$array[] = basename($path, '.blade.php');
164-
}
165-
166161
return array_unique(
167162
array_merge(
168-
$array,
163+
CollectionService::getBladePageList(),
169164
CollectionService::getMarkdownPageList()
170165
)
171166
);

0 commit comments

Comments
 (0)