|
4 | 4 |
|
5 | 5 | use Hyde\Framework\Features;
|
6 | 6 | use Hyde\Framework\Hyde;
|
| 7 | +use Hyde\Framework\Models\DocumentationPage; |
7 | 8 | use Hyde\Framework\Services\CollectionService;
|
8 | 9 | use Illuminate\Support\Str;
|
9 | 10 | use JetBrains\PhpStorm\Pure;
|
@@ -78,12 +79,12 @@ private function getLinks(): array
|
78 | 79 | // And there is no link to the docs...
|
79 | 80 | if (! in_array('Docs', array_column($links, 'title'))) {
|
80 | 81 | // 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')) { |
82 | 83 | // Then we can add a link.
|
83 | 84 | $links[] = [
|
84 | 85 | 'title' => 'Docs',
|
85 | 86 | 'route' => $this->getRelativeRoutePathForSlug(
|
86 |
| - file_exists('_docs/index.md') |
| 87 | + file_exists(DocumentationPage::$sourceDirectory.'/index.md') |
87 | 88 | ? Hyde::docsDirectory().'/index'
|
88 | 89 | : Hyde::docsDirectory().'/readme'
|
89 | 90 | ),
|
@@ -157,15 +158,9 @@ public function getTitleFromSlug(string $slug): string
|
157 | 158 | #[Pure]
|
158 | 159 | private function getListOfCustomPages(): array
|
159 | 160 | {
|
160 |
| - $array = []; |
161 |
| - |
162 |
| - foreach (glob(Hyde::path('_pages/*.blade.php')) as $path) { |
163 |
| - $array[] = basename($path, '.blade.php'); |
164 |
| - } |
165 |
| - |
166 | 161 | return array_unique(
|
167 | 162 | array_merge(
|
168 |
| - $array, |
| 163 | + CollectionService::getBladePageList(), |
169 | 164 | CollectionService::getMarkdownPageList()
|
170 | 165 | )
|
171 | 166 | );
|
|
0 commit comments