Header is now a link to home, feeds are added to links
parent
92a272c03d
commit
a7d698b0d7
10
lib/Blog.php
10
lib/Blog.php
|
@ -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
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 ?>
|
||||
|
|
Loading…
Reference in New Issue