Skip to content

Commit

Permalink
Fix #350, Use the model path properties
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed May 15, 2022
1 parent 566329d commit 927fe66
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/Actions/GeneratesNavigationMenu.php
Expand Up @@ -4,6 +4,7 @@

use Hyde\Framework\Features;
use Hyde\Framework\Hyde;
use Hyde\Framework\Models\DocumentationPage;
use Hyde\Framework\Services\CollectionService;
use Illuminate\Support\Str;
use JetBrains\PhpStorm\Pure;
Expand Down Expand Up @@ -78,12 +79,12 @@ private function getLinks(): array
// And there is no link to the docs...
if (! in_array('Docs', array_column($links, 'title'))) {
// But a suitable file exists...
if (file_exists('_docs/index.md') || file_exists('_docs/readme.md')) {
if (file_exists(DocumentationPage::$sourceDirectory.'/index.md') || file_exists(DocumentationPage::$sourceDirectory.'/readme.md')) {
// Then we can add a link.
$links[] = [
'title' => 'Docs',
'route' => $this->getRelativeRoutePathForSlug(
file_exists('_docs/index.md')
file_exists(DocumentationPage::$sourceDirectory.'/index.md')
? Hyde::docsDirectory().'/index'
: Hyde::docsDirectory().'/readme'
),
Expand Down Expand Up @@ -157,15 +158,9 @@ public function getTitleFromSlug(string $slug): string
#[Pure]
private function getListOfCustomPages(): array
{
$array = [];

foreach (glob(Hyde::path('_pages/*.blade.php')) as $path) {
$array[] = basename($path, '.blade.php');
}

return array_unique(
array_merge(
$array,
CollectionService::getBladePageList(),
CollectionService::getMarkdownPageList()
)
);
Expand Down

0 comments on commit 927fe66

Please sign in to comment.