forked from team/site
1
0
Fork 0
tilde.team/wiki/index.php

77 lines
2.3 KiB
PHP
Raw Normal View History

2018-06-04 02:18:02 +00:00
<?php
require __DIR__.'/../vendor/autoload.php';
2018-06-09 00:31:07 +00:00
2018-06-09 00:22:19 +00:00
$additional_head = '
<style>
a.anchor {
display: block;
position: relative;
top: -250px;
visibility: hidden;
}
</style>
';
2018-06-04 02:18:02 +00:00
2018-06-09 00:31:07 +00:00
2018-06-04 06:18:28 +00:00
$parser = new Mni\FrontYAML\Parser();
if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
$title = "tilde.team~wiki";
$additional_head .= "
<meta property='og:title' content='$title'>
<meta property='og:type' content='website'>
<meta property='og:image' content='https://tilde.team/apple-icon.png'>
2018-06-20 16:02:28 +00:00
<meta property='og:url' content='https://tilde.team{$_SERVER['REQUEST_URI']}'>
2018-06-09 14:28:17 +00:00
<meta property='og:description' content='tilde.team wiki'>
2018-06-09 15:10:23 +00:00
<meta property='og:site_name' content='tilde.team wiki'>
";
include __DIR__.'/../header.php';
// render wiki index ?>
<h1>tilde.team wiki</h1>
2018-06-04 02:18:02 +00:00
<p>welcome to the tilde.team wiki!</p>
2018-06-04 02:18:02 +00:00
2018-08-08 17:09:33 +00:00
<p>if you want to contribute, check out the
<a href="https://git.tildeverse.org/team/site/src/branch/master/wiki">source</a> and open a PR!
</p>
2018-06-04 02:18:02 +00:00
<hr>
<h3>pages:</h3>
2018-06-04 02:18:02 +00:00
<?php
foreach (glob("pages/*.md") as $page) {
$yaml = $parser->parse(file_get_contents($page))->getYAML();
if (!$yaml["published"]) continue; ?>
2018-06-09 03:17:35 +00:00
<a href="?page=<?=basename($page, ".md")?>"><?=$yaml["title"]?></a><br>
<?php }
2018-06-04 06:18:28 +00:00
} else {
$pg = $parser->parse(file_get_contents("pages/{$_GET["page"]}.md"));
2018-06-09 17:24:47 +00:00
$yml = $pg->getYAML();
$title = $yml['title'] . " | tilde.team~wiki";
$description = $yml['description'] ?? "tilde.team wiki article {$yml['title']}";
$additional_head .= "
<meta property='og:title' content='$title'>
<meta property='og:type' content='website'>
<meta property='og:image' content='https://tilde.team/apple-icon.png'>
<meta property='og:url' content='https://tilde.team{$_SERVER['REQUEST_URI']}'>
<meta property='og:description' content='$description'>
<meta property='og:site_name' content='tilde.team wiki'>
";
include __DIR__.'/../header.php';
// show a single page ?>
2018-06-09 03:17:35 +00:00
<a href=".">&lt; ~wiki</a>
<hr>
2018-07-12 14:44:58 +00:00
<?=str_replace("<table", '<table class="table table-striped"', $pg->getContent())?>
<hr>
2018-07-26 15:35:29 +00:00
<a href="https://git.tildeverse.org/team/site/src/branch/master/wiki/pages/<?=$_GET["page"]?>.md">
2018-06-07 20:57:47 +00:00
<i class="fa fa-edit"></i> source
</a>
<?php }
2018-06-04 06:18:28 +00:00
2018-06-04 02:18:02 +00:00
include __DIR__.'/../footer.php';