mv entry.php entries/index.php

This commit is contained in:
Ben Harris 2019-09-09 20:36:41 -04:00
parent 097e543ebf
commit b75ef577b1
Signed by untrusted user: ben
GPG Key ID: 4E0AF802FFF7960C
2 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@ Currently hosted at [journal.tildeverse.org](https://journal.tildeverse.org/).
this site requires an nginx rewrite to properly server entries:
location ~* ^/entries/(.+)$ {
try_files $uri $uri/ /entry.php?slug=$1;
try_files $uri $uri/ /entries/$1;
include snippets/php.conf;
}

View File

@ -1,5 +1,5 @@
<?php
include "vendor/autoload.php";
include __DIR__."/../vendor/autoload.php";
$parser = Tildeverse\Wiki\Parser::factory();
@ -11,7 +11,7 @@ if (isset($_GET["slug"])) {
$entry_name = "";
}
$filename = "entries/{$entry_name}.md";
$filename = "{$entry_name}.md";
if (file_exists($filename)) {
$document = $parser->parse(file_get_contents($filename));
@ -21,7 +21,7 @@ if (file_exists($filename)) {
$author = htmlspecialchars($yml["author"]);
$description = "journal entry {$entry_name}: {$yml["title"]} by {$author}";
include "header.php";
include __DIR__."/../header.php";
?>
<a href=".">&lt; back to list</a>
@ -41,9 +41,9 @@ if (file_exists($filename)) {
} else {
$title="journal entries";
$description="a list of tildeverse journal entries.";
include "header.php";
include __DIR__."/../header.php";
foreach (glob("entries/*.md") as $entry) {
foreach (glob("*.md") as $entry) {
$entries[] = [
"slug" => basename($entry, ".md"),
"yml" => $parser->parse(file_get_contents($entry))->getYAML(),
@ -55,7 +55,7 @@ if (file_exists($filename)) {
<?php foreach ($entries as $entry) {
if (!$entry["yml"]["published"]) continue; ?>
<li>
<a href="/entry.php?slug=<?=$entry["slug"]?>">
<a href="/entries/<?=$entry["slug"]?>">
<?=$entry["yml"]["title"]?> by <?=$entry["yml"]["author"]?>
</a>
</li>
@ -63,5 +63,5 @@ if (file_exists($filename)) {
</ul>
<?php }
include "footer.php"; ?>
include __DIR__."/../footer.php"; ?>