sort wikipages by title
This commit is contained in:
parent
f805f70680
commit
369726159f
|
@ -20,6 +20,19 @@ if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
|
|||
<meta property='og:description' content='tilde.team wiki'>
|
||||
";
|
||||
include __DIR__.'/../header.php';
|
||||
|
||||
$pages = [];
|
||||
foreach (glob("pages/*.md") as $page) {
|
||||
$yaml = $parser->parse(file_get_contents($page))->getYAML();
|
||||
if (!$yaml["published"]) continue;
|
||||
$pages[] = [
|
||||
"title" => $yaml["title"],
|
||||
"description" => $yaml["description"],
|
||||
"name" => basename($page, ".md"),
|
||||
];
|
||||
}
|
||||
usort($pages, function($a, $b) { return $a["title"] <=> $b["title"]; });
|
||||
|
||||
// render wiki index ?>
|
||||
|
||||
<h1>tilde.team wiki</h1>
|
||||
|
@ -40,10 +53,11 @@ if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach (glob("pages/*.md") as $page) {
|
||||
$yaml = $parser->parse(file_get_contents($page))->getYAML();
|
||||
if (!$yaml["published"]) continue; ?>
|
||||
<tr><td><a href="<?=basename($page, ".md")?>"><?=$yaml["title"]?></a></td> <td><?=$yaml["description"] ?? ""?></td></tr>
|
||||
<?php foreach ($pages as $page) { ?>
|
||||
<tr>
|
||||
<td><a href="<?=$page["name"]?>"><?=$page["title"]?></a></td>
|
||||
<td><?=$page["description"] ?? ""?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue