Header is now a link to home, feeds are added to links

master
Nicolas Ong 2025-02-14 22:22:08 +01:00
parent 92a272c03d
commit a7d698b0d7
4 changed files with 16 additions and 3 deletions

View File

@ -3,6 +3,7 @@
final class Blog
{
private array $own_links = [];
private array $links = [];
public function __construct()
@ -18,6 +19,11 @@ final class Blog
private function loadConfig()
{
require_once "config.php";
foreach ($own_links as $title => $url) {
$this->own_links[] = new Link($title, $url);
}
$this->own_links[] = new Link("RSS feed", BLOG_LINK . "/rss.php");
$this->own_links[] = new Link("Atom feed", BLOG_LINK . "/atom.php");
foreach ($links as $title => $url) {
$this->links[] = new Link($title, $url);
}
@ -47,7 +53,8 @@ final class Blog
return [
"title" => BLOG_TITLE,
"has_sub_title" => BLOG_SUB_TITLE !== "",
"sub_title" => BLOG_SUB_TITLE
"sub_title" => BLOG_SUB_TITLE,
"blog_link" => BLOG_LINK
];
}
@ -80,6 +87,7 @@ final class Blog
return [
"author" => AUTHOR_NICKNAME,
"bio" => AUTHOR_BIOGRAPHY,
"own_links" => $this->own_links
];
}

View File

@ -26,7 +26,7 @@ final class Feed
private function render()
{
header("Content-Type: application/" . $this->type . "+xml");
header("Content-Type: application/xml");
$file = self::BASE_PATH . $this->type . ".xml";
$latest = self::BASE_PATH . "latest";
if (!is_file($file) or filemtime($file) < filemtime($latest)) {

View File

@ -3,5 +3,10 @@
<img src="./data/images/avatar.jpg" alt="<?=$author?>" class="portrait">
<figcaption><?=$author?></figcaption>
</figure>
<ul class="own_links">
<?php foreach ($own_links as $link): ?>
<li class="icon"><a rel="me" href="<?=$link->url?>" class="icon <?=$link->title?>"><?=$link->title?></a></li>
<?php endforeach ?>
</ul>
<p><?=$bio?></p>
</div>

View File

@ -1,5 +1,5 @@
<header>
<h1><?=$title?></h1>
<h1><a href="<?=$blog_link?>"><?=$title?></a></h1>
<?php if ($has_sub_title): ?>
<h2><?=$sub_title?></h2>
<?php endif ?>