initial commit

This commit is contained in:
spider 2021-01-20 14:27:27 +11:00
commit 9fd5fbb975
3 changed files with 94 additions and 0 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# [~cafe/wiki](https://tilde.cafe/wiki/)
this is the content for the tilde.cafe wiki

76
index.php Normal file
View File

@ -0,0 +1,76 @@
<?php
$filepath = __FILE__;
require __DIR__.'/../vendor/autoload.php';
$additional_head = "
<style>
:target:before {
content:\"\";
display:block;
height:50px; /* fixed header height*/
margin:-50px 0 0; /* negative fixed header height */
}
</style>
<meta property='og:type' content='website'>
<meta property='og:image' content='https://tilde.cafe/apple-icon.png'>
<meta property='og:site_name' content='tilde.cafe wiki'>
";
$parser = Tildeverse\Wiki\Parser::factory();
if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
$title = "~cafe wiki";
$additional_head .= "
<meta property='og:title' content='$title'>
<meta property='og:url' content='https://tilde.cafe{$_SERVER['REQUEST_URI']}'>
<meta property='og:description' content='tilde.cafe wiki'>
";
include __DIR__.'/../header.php';
// render wiki index ?>
<h1>~wiki</h1>
<p>Welcome to the tilde.cafe wiki!</p>
<p>If you want to contribute, check out the
<a href="https://tildegit.org/cafe/site/src/branch/master/wiki">source</a> and open a PR!
</p>
<hr>
<h3>pages:</h3>
<?php
foreach (glob("pages/*.md") as $page) {
$yaml = $parser->parse(file_get_contents($page))->getYAML();
if (!$yaml["published"]) continue; ?>
<li><a href="<?=basename($page, ".md")?>"><?=$yaml["title"]?></a><br></li>
<?php }
} else {
$pg = $parser->parse(file_get_contents("pages/{$_GET["page"]}.md"));
$yml = $pg->getYAML();
$title = $yml['title'] . " | tilde.cafe~wiki";
$description = $yml['description'] ?? "tilde.cafe wiki article {$yml['title']}";
$additional_head .= "
<meta property='og:title' content='$title'>
<meta property='og:url' content='https://tilde.cafe{$_SERVER['REQUEST_URI']}'>
<meta property='og:description' content='$description'>
";
include __DIR__.'/../header.php';
// show a single page ?>
<a href=".">&lt; ~wiki</a>
<hr>
<?=$pg->getContent()?>
<hr>
<a href="#">
<i class="fa fa-edit"></i> source
</a>
<?php }
//include __DIR__.'/../footer.php';

15
pages/linux.md Normal file
View File

@ -0,0 +1,15 @@
---
author: ~spider
published: true
title: linux 101
description: basic linux commands
category:
- main
---
# Linux 101
This is a test [link](http://google.com/).
* I don't know
* If this works