Fixes for @tomasino's requested changes

pull/20/head
Anton McClure 8 months ago
parent 9caa98af17
commit 9676578b5b
Signed by untrusted user: anton
GPG Key ID: 420B5F905BF0567B
  1. 43
      entries/index.php

@ -20,9 +20,17 @@ if (file_exists($filename)) {
$yml = $document->getYAML();
$content = $document->getContent();
$title = $yml["title"] ?? "invalid";
$author_name = htmlspecialchars($yml["author-name"]);
$author_link = htmlspecialchars($yml["author-link"]);
$original_link = htmlspecialchars($yml["original"]);
$date = htmlspecialchars($yml["date"]);
$author_name = htmlspecialchars($yml["author_name"]);
if (isset($yml["author_link"])) {
$author_link = htmlspecialchars($yml["author_link"]);
$author = "<a href=\"$author_link\">$author_name</a>";
} else {
$author = $author_name;
}
if (isset($yml["original_link"])):
$original_link = htmlspecialchars($yml["original_link"]);
endif;
$description = "journal entry {$entry_name}: {$yml["title"]} by {$author}";
include __DIR__."/../header.php";
@ -31,16 +39,16 @@ if (file_exists($filename)) {
<a href=".">&lt; back to list</a>
<h1>
<?=$yml["title"]?>
<?=$title?>
<?=$yml["published"] ? "" : " <small><em>draft</em></small>" ?>
</h1>
<p>author: <a href="<?=$author_link?>"><?=$author_name?></a></p>
<p>date: <?=$yml["date"]?></p>
<br />
<?php if ($yml["original"]): ?>
<p>Originally published at <a href="<?=$original_link?>"><?=$original_link?></a>.</p>
<p>author: <?=$author?></p>
<p>date: <?=$date?></p>
<br />
<?php if (isset($original_link)): ?>
<p>Originally published at <a href="<?=$original_link?>"><?=$original_link?></a>.</p>
<br />
<?php endif; ?>
<?=$content?>
@ -61,11 +69,22 @@ if (file_exists($filename)) {
<h1>journal entries</h1>
<ul>
<?php foreach ($entries as $entry) {
if (!$entry["yml"]["published"]) continue; ?>
if (!$entry["yml"]["published"]) continue;
$title = $entry["yml"]["title"] ?? "invalid";
$date = htmlspecialchars($entry["yml"]["date"]);
$author_name = htmlspecialchars($entry["yml"]["author_name"]);
if (isset($entry["yml"]["author_link"])) {
$author_link = htmlspecialchars($entry["yml"]["author_link"]);
$author = "<a href=\"$author_link\">$author_name</a>";
} else {
$author = $author_name;
} ?>
<li>
<a href="/entries/<?=$entry["slug"]?>"><?=$entry["yml"]["title"]?></a>
<a href="/entries/<?=$entry["slug"]?>"><?=$title?></a>
by
<a href="<?=$entry["yml"]["author-link"]?>"><?=$entry["yml"]["author-name"]?></a>
<?=$author?>
&mdash;
<?=$date?>
</li>
<?php } ?>
</ul>

Loading…
Cancel
Save