feat: initial commit

This commit is contained in:
NaitLee 2025-09-10 19:51:13 +08:00
commit 928ebf762e
22 changed files with 578 additions and 0 deletions

12
tpl/bio.php Normal file
View file

@ -0,0 +1,12 @@
<div class="bio">
<div class="bio__pic">
<img height="640" src="/assets/amahara-full.webp" alt="雨晴的立繪">
</div>
<div class="bio__name">
<h1 class="bio__name__main">緒山 雨晴</h1>
<p class="bio__name__sub">Amahara Oyama</p>
</div>
<div class="bio__intro">
<?= $page["content"] ?>
</div>
</div>

21
tpl/default.php Normal file
View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="<?php if (empty($page["lang"])) echo "zh-TW"; else echo $page["lang"]; ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= $page["title"] ?></title>
<link rel="stylesheet" href="/assets/main.css" />
<?php if ($page["path"] === "index.md") echo "<link rel=\"stylesheet\" href=\"/assets/frontpage.css\" />" ?>
</head>
<body>
<?php include "nav.php" ?>
<main>
<?php
if ($page["path"] === "index.md") include "bio.php";
else if ($page["path"] === "pages.md") include "pages-index.php";
else if (!empty($page["content"])) echo $page["content"];
else echo "此頁為空";
?>
</main>
</body>
</html>

11
tpl/nav.php Normal file
View file

@ -0,0 +1,11 @@
<nav>
<a href="/" class="logo-link">
<svg class="logo" height="36" viewBox="0 0 512 64" aria-label="Amaharacya.one">
<use xlink:href="/assets/logo.svg#amaharacya-one-logo" />
</svg>
</a>
<div class="nav__links">
<a href="/pages.html">文章</a>
<a href="/">關於</a>
</div>
</nav>

39
tpl/pages-index.php Normal file
View file

@ -0,0 +1,39 @@
<?php
// modified from https://codeberg.org/fsfans-cn/www/src/branch/new/template/dirlisting.php
$child_pages = [];
foreach (get_page_list("page") as $path) {
$child_page = get_page($path);
if (
(isset($child_page["unlisted"]) && $child_page["unlisted"])
|| $page["path"] == $path
) continue;
$href = "/" . substr_replace($child_page["path"], "html", -2);
if ($pos = strrpos($href, "/index.html")) {
$href = substr($href, 0, $pos + 1);
}
$date = 0;
if (!empty($child_page["date"]))
$date = date_create($child_page["date"]);
else
$date = filemtime("src/" . $child_page["path"]);
array_push($child_pages, [
"title" => $child_page["title"],
"date" => $date,
"href" => $href
]);
}
array_multisort(
array_column($child_pages, "date"), SORT_DESC,
$child_pages
);
?>
<h1>文章</h1>
<h2>索引</h2>
<ul class="pages-index">
<?php
foreach ($child_pages as $page)
echo "<li><span>", date("Y-m-d", $page["date"]), "</span> | <a href=\"", $page["href"], "\">", $page["title"], "</a></li>\n";
?>
</ul>