feat: dark color scheme, omnisrv support, correct page dates

This commit is contained in:
NaitLee 2025-09-29 18:02:10 +08:00
parent dbaeaf24fa
commit c8b4ac408e
9 changed files with 90 additions and 33 deletions

View file

@ -1,27 +1,67 @@
# amaharacya.one # amaharacya.one
本網站的主頁。
## 基本流程 ## 基本流程
1. 克隆此倉庫 首先,克隆此倉庫:
- `git clone --recursive https://git.amaharacya.one/amainait/amaharacya.one.git`
2. 選擇 SSG 引擎 - `git clone https://git.amaharacya.one/amainait/amaharacya.one.git`
- [dummy-ssg](https://codeberg.org/haydenwu/dummy-ssg): 準備依賴: `apt install php-cli php-mbstring php-xml`
<!-- - omnisrv: 即將推出 -->
3. 構建靜態頁面 之後,選擇任一伺服方案:
### [dummy-ssg](https://codeberg.org/haydenwu/dummy-ssg)
<details>
<summary>展開閱讀</summary>
1. 準備 dummy-ssg 環境
- 準備子模組: `git submodule update --init ssg`
- 準備依賴: `apt install php-cli php-mbstring php-xml`
- 對於非 Debian 系統,可直接運行 `./mk.sh`,參考錯誤訊息補充缺失的 PHP 依賴。一些發行版的 PHP 自帶 php_mbstring 和 php-xml。
2. 構建靜態頁面
- `./mk.sh` - `./mk.sh`
- 結果置於 `out` 目錄。 - 結果置於 `out` 目錄。
4. 伺服 3. 伺服
- `python3 -m http.server -d out` - `python3 -m http.server -d out`
- 正式部署請使用更好的靜態檔案伺服器。 - 正式部署請使用更好的靜態檔案伺服器。
</details>
### [omnisrv](https://codeberg.org/NaitLee/omnisrv)
<details>
<summary>展開閱讀</summary>
1. 準備 omnisrv 程式:
```sh
git clone https://codeberg.org/NaitLee/omnisrv.git
cd omnisrv
go build ./bin ./cmd/...
export PATH="$(pwd)/bin:$PATH"
```
若無法安裝 Go 依賴,可配置 [Goproxy](https://goproxy.cn/)。
2. **任選一個**使用方式:
```sh
cd ../amaharacya.one
omnisrv -site src -addr [::]:8080
omnisrv-ssg -site src -out out
omnisrv-9p -site src -proto unix -addr /tmp/omnisrv
```
</details>
## 小技巧 ## 小技巧
新頁面放在 `src/pages` 新頁面放在 `src/page`。
PHP 模板在 `tpl/*.php` PHP 模板在 `tpl/*.php`omnisrv 模板為 `tmpl.html`
一級標題在 `/page` 頁面自動列出。 一級標題在 `/page` 頁面自動列出。
@ -29,13 +69,14 @@ PHP 模板在 `tpl/*.php`。
``` ```
--- ---
title Building Website title 標題
lang en-US lang zh-TW
date 2025-09-29
--- ---
# About How to Build a Website # 長標題
... 正文...
``` ```
## 授權 ## 授權

2
mk.sh
View file

@ -6,7 +6,7 @@ if [ ! -e ssg/main.php ]; then
echo "Try to install git, then run this script again" echo "Try to install git, then run this script again"
exit 1 exit 1
fi fi
if ! git submodule update --init --recursive; then if ! git submodule update --init ssg; then
if [ ! -e ssg/main.php ]; then if [ ! -e ssg/main.php ]; then
echo "error: failed to init submodule dummy-ssg" echo "error: failed to init submodule dummy-ssg"
echo "Check your network connection and the error message above" echo "Check your network connection and the error message above"

View file

@ -1,3 +1,7 @@
---
status 404
---
# 404 Not Found # 404 Not Found
<div style="text-align: center;"> <div style="text-align: center;">

View file

@ -17,7 +17,6 @@ body {
color: var(--fore); color: var(--fore);
background-color: var(--back); background-color: var(--back);
font-family: "Noto Sans", "Noto Sans CJK TW", "Noto Sans TW", sans-serif; font-family: "Noto Sans", "Noto Sans CJK TW", "Noto Sans TW", sans-serif;
/* font-size: large; */
} }
a:any-link { a:any-link {
@ -39,6 +38,12 @@ main {
line-height: 1.8; line-height: 1.8;
} }
main > img {
display: block;
width: 29.7cm;
max-width: 100%;
}
nav { nav {
margin-top: 1em; margin-top: 1em;
padding: 0 16pt; padding: 0 16pt;
@ -50,6 +55,7 @@ nav {
top: 0; top: 0;
text-align: center; text-align: center;
background-color: var(--back); background-color: var(--back);
z-index: 1;
} }
nav a { nav a {
display: inline-block; display: inline-block;
@ -115,17 +121,15 @@ table.pages td:nth-child(1) {
} }
} }
/*
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
--fore: #6991b9; --fore: #a0b8d0;
--back: #101010; --back: #121212;
--theme: #57a0e1; --theme: #5aa5e6;
--shade: rgba(255, 255, 255, 0.15); --shade: rgba(255, 255, 255, 0.15);
} }
img { img {
filter: brightness(0.8); filter: brightness(0.95);
} }
} }
*/

View file

@ -1,3 +1,7 @@
---
date 2025-09-14
---
# 本站建有 Git 服務 # 本站建有 Git 服務
## 簡介 ## 簡介

View file

@ -1,3 +1,7 @@
---
date 2025-09-14
---
# 本站建有 XMPP 服務 # 本站建有 XMPP 服務
## 簡介 ## 簡介

View file

@ -1,7 +1,5 @@
--- ---
{ date 2025-09-10
"lang": "en"
}
--- ---
# Hello, world! # Hello, world!

View file

@ -1,3 +1,7 @@
---
date 2025-09-24
---
# 本站提供伺服器出租服務 # 本站提供伺服器出租服務
## 簡介 ## 簡介

View file

@ -15,16 +15,14 @@
{{- template "bio" . -}} {{- template "bio" . -}}
{{- else if eq .Url "/page" -}} {{- else if eq .Url "/page" -}}
{{- template "pages" . -}} {{- template "pages" . -}}
{{- else if .Contentful -}}
{{- .Html -}}
{{- else -}} {{- else -}}
<p>此頁為空</p> {{- .Html -}}
{{- end}} {{- end}}
</main> </main>
</body> </body>
</html> </html>
{{define "nav"}} {{- define "nav" -}}
<nav> <nav>
<a href="/" class="logo-link"> <a href="/" class="logo-link">
<svg class="logo" height="36" viewBox="0 0 512 64" aria-label="Amaharacya.one"> <svg class="logo" height="36" viewBox="0 0 512 64" aria-label="Amaharacya.one">
@ -36,9 +34,9 @@
<a href="/">關於</a> <a href="/">關於</a>
</div> </div>
</nav> </nav>
{{end}} {{- end -}}
{{define "bio"}} {{- define "bio" -}}
<div class="bio"> <div class="bio">
<div class="bio__pic"> <div class="bio__pic">
<img height="640" src="/assets/amahara-full.webp" alt="雨晴的立繪"> <img height="640" src="/assets/amahara-full.webp" alt="雨晴的立繪">
@ -49,9 +47,9 @@
</div> </div>
<div class="bio__intro">{{.Html}}</div> <div class="bio__intro">{{.Html}}</div>
</div> </div>
{{end}} {{- end -}}
{{define "pages"}} {{- define "pages" -}}
{{.Html}} {{.Html}}
<table class="pages"> <table class="pages">
<tbody> <tbody>
@ -63,4 +61,4 @@
{{- end -}} {{- end -}}
</tbody> </tbody>
</table> </table>
{{end}} {{- end -}}