sort wikipages by title and display as a table
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
ee1886e6b8
commit
6bda5a078f
|
@ -26,6 +26,20 @@ if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
|
|||
<meta property='og:description' content='tilde.chat 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" => $page,
|
||||
];
|
||||
}
|
||||
usort($pages, function($a, $b) { return $a["title"] <=> $b["title"]; });
|
||||
|
||||
// render wiki index ?>
|
||||
|
||||
<h1>tilde.chat wiki</h1>
|
||||
|
@ -38,14 +52,24 @@ if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
|
|||
<p>commits to master will be automatically deployed</p>
|
||||
|
||||
<hr>
|
||||
<h3>pages:</h3>
|
||||
|
||||
<?php
|
||||
foreach (glob("pages/*.md") as $page) {
|
||||
$yaml = $parser->parse(file_get_contents($page))->getYAML();
|
||||
if (!$yaml["published"]) continue; ?>
|
||||
<a href="<?=basename($page, ".md")?>"><?=$yaml["title"]?></a><br>
|
||||
<?php }
|
||||
<h2>pages:</h2>
|
||||
<table class="table table-responsive table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>title</th>
|
||||
<th>description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($pages as $page) { ?>
|
||||
<tr>
|
||||
<td><a href="<?=$pages["name"]?>"><?=$page["title"]?></a></td>
|
||||
<td><?=$page["description"] ?? ""?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
|
||||
} else {
|
||||
|
||||
|
|
Loading…
Reference in New Issue