-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
42 lines (34 loc) · 1.19 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
use Illuminate\Support\Str;
return [
'baseUrl' => 'https://smplphp.dev',
'production' => false,
'siteName' => 'SMPL - Simple, modern PHP libraries',
'siteDescription' => '',
// Algolia DocSearch credentials
'docsearchApiKey' => '',
'docsearchIndexName' => '',
// navigation menu
'navigation' => require_once('navigation.php'),
// helpers
'isActive' => function ($page, $path, $abs = false) {
$pagePath = $page->getPath();
if (! str_starts_with($pagePath, '/')) {
$pagePath = '/' . $pagePath;
}
if (! $abs) {
return str_starts_with($pagePath, $path);
}
return $pagePath === $path;
},
'isActiveParent' => function ($page, $menuItem) {
if (is_object($menuItem) && $menuItem->children) {
return $menuItem->children->contains(function ($child) use ($page) {
return trimPath($page->getPath()) == trimPath($child);
});
}
},
'url' => function ($page, $path) {
return Str::startsWith($path, 'http') ? $path : '/' . trimPath($path);
},
];