forked from team/site
1
0
Fork 0

use title from md instead of filename for page title

This commit is contained in:
Ben Harris 2018-06-08 20:36:52 -04:00
parent e98e9b89c4
commit 31fd8a479b
2 changed files with 20 additions and 15 deletions

View File

@ -14,37 +14,42 @@ a.anchor {
}
</style>
';
include __DIR__.'/../header.php';
$parser = new Mni\FrontYAML\Parser();
if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
// render wiki index ?>
$title = "tilde.team~wiki";
include __DIR__.'/../header.php';
// render wiki index ?>
<h1>tilde.team wiki</h1>
<h1>tilde.team wiki</h1>
<p>welcome to the tilde.team wiki!</p>
<p>welcome to the tilde.team wiki!</p>
<p>if you want to contribute, check out the <a href="https://git.tilde.team/meta/site/src/branch/master/wiki">source!</a></p>
<p>if you want to contribute, check out the <a href="https://git.tilde.team/meta/site/src/branch/master/wiki">source!</a></p>
<hr>
<h3>pages:</h3>
<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="/wiki/?page=<?=basename($page, ".md")?>"><?=$yaml["title"]?></a><br>
<?php
foreach (glob("pages/*.md") as $page) {
$yaml = $parser->parse(file_get_contents($page))->getYAML();
if (!$yaml["published"]) continue; ?>
<a href="/wiki/?page=<?=basename($page, ".md")?>"><?=$yaml["title"]?></a><br>
<?php }
<?php }
} else {
$pg = $parser->parse(file_get_contents("pages/{$_GET["page"]}.md"));
$title = $pg->getYAML()['title'] . " | tilde.team~wiki";
include __DIR__.'/../header.php';
// show a single page ?>
<a href="/wiki/">&lt; ~wiki</a>
<hr>
<?=$parser->parse(file_get_contents("pages/{$_GET['page']}.md"))->getContent()?>
<?=$pg->getContent()?>
<hr>
<a href="https://git.tilde.team/meta/site/src/branch/master/wiki/pages/<?=$_GET["page"]?>.md">
<i class="fa fa-edit"></i> source

View File

@ -1,7 +1,7 @@
---
author: ~ben
published: true
title: getting-started
title: getting started
category:
- main
---