-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.php
68 lines (57 loc) · 1.97 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
Dotenv\Dotenv::create(__DIR__)->load();
$accessToken = env('ACCESS_TOKEN');
$rootConcept = env('ROOT_CONCEPT');
$context = stream_context_create([
'http' => [
'method' => 'GET',
'header' => "Accept: 'application/json\r\n"
. "Authorization: Bearer $accessToken\r\n",
]
]);
$site = json_decode(file_get_contents(
'https://knowfox.com/api/concept/' . $rootConcept,
false,
$context
));
return [
'baseUrl' => '',
'production' => false,
'siteName' => 'Knowfox',
'siteDescription' => "Users' and Developers' Manual",
'siteSummary' => 'Knowfox is Open Source Software for Personal Knowledge Management. <br class="hidden sm:block">You can use our hosted service or run it on your own.',
// Algolia DocSearch credentials
'docsearchApiKey' => '',
'docsearchIndexName' => '',
// navigation menu
'navigation' => require_once('navigation.php'),
// helpers
'isActive' => function ($page, $path) {
return ends_with(trimPath($page->getPath()), trimPath($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 starts_with($path, 'http') ? $path : '/' . trimPath($path);
},
'collections' => [
'docs' => [
'extends' => '_layouts.documentation',
'items' => function () use ($site) {
var_dump($site->children);
return collect($site->children)->map(function ($doc) {
return [
'title' => $doc->title,
'filename' => $doc->slug,
'content' => $doc->body,
];
});
}
]
]
];