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'>
|
<meta property='og:description' content='tilde.team wiki'>
|
||||||
";
|
";
|
||||||
include __DIR__.'/../header.php';
|
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 ?>
|
// render wiki index ?>
|
||||||
|
|
||||||
<h1>tilde.team wiki</h1>
|
<h1>tilde.team wiki</h1>
|
||||||
|
@ -40,10 +53,11 @@ if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach (glob("pages/*.md") as $page) {
|
<?php foreach ($pages as $page) { ?>
|
||||||
$yaml = $parser->parse(file_get_contents($page))->getYAML();
|
<tr>
|
||||||
if (!$yaml["published"]) continue; ?>
|
<td><a href="<?=$page["name"]?>"><?=$page["title"]?></a></td>
|
||||||
<tr><td><a href="<?=basename($page, ".md")?>"><?=$yaml["title"]?></a></td> <td><?=$yaml["description"] ?? ""?></td></tr>
|
<td><?=$page["description"] ?? ""?></td>
|
||||||
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue