1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# www.sillylaird.ca
Personal homepage. PHP 8.3 (no framework, no build step) served from this
directory. Pages are plain `.php` files; shared markup lives in `partials/`.
## Layout
- `index.php`, `links.php`, `guestbook.php`, … — top-level pages.
- `partials/` — shared includes:
- `head_meta.php` — OG / Twitter / canonical / hreflang / favicon / feed
boilerplate. Pass a `$meta` array, then `include` it (see `links.php`).
Supports `self_url` / `en_url` / `x_default` overrides for non-default
canonicals (the homepage uses these to keep its EN canonical at root `/`).
- `header.php`, `footer.php` — site chrome.
- `i18n.php` — `t($key)` lookup; locale detected from the `_jp` / `_zh`
filename suffix. Dicts live in `locales/{en,ja,zh}.php`.
- `session.php`, `site_status.php`, `recent_static.php`, `partials_vibe.php`,
`proxy_helpers.php` — session bootstrap, status banner, recent-update
renderers, and helpers for the API proxies.
- `assets/` — `css/`, `js/`, `img/`, `fonts/`. CSS/JS are cache-busted with
`?v=<filemtime>` (see the `$_av()` helper in `index.php`).
- `locales/` — flat key → string translation dicts.
- Translated pages: each page has `_jp.php` / `_zh.php` variants that
`require` the base page; `i18n.php` picks the locale from the filename.
- Proxies: `gemini-proxy.php`, `lastfm-proxy.php`, etc. shield API keys.
- Admin password: `/var/lib/sillylaird/admin_auth.php` (outside docroot;
override with `ADMIN_AUTH_FILE`). Prefer `password_hash`; legacy sha256+salt
still works. Generate a new hash: `php /mnt/slab/make_admin_hash.php`.
## Common maintenance
- `python3 tools/link_check.py` — internal link sanity check (scans `.php` and `.html`)
- `python3 tools/html_audit.py` — quick a11y/markup audit (scans `.php` and `.html`)
- `python3 tools/generate_sitemap.py` — rebuild `sitemap.xml` (handles `.php` triples with hreflang)
- `python3 tools/translate_pages.py` — generate missing `*_zh`/`*_jp` pages
- `python3 tools/link_rot.py` — check external links for rot (see `--help`)
- `python3 tools/image_budget.py` — flag oversized images
- `./tools/optimize_images.sh` — recompress/resize images in place (backs up originals first; `DRY_RUN=1` to preview)
- `./tools/run_audits.sh` — run the audits + sitemap together; intended for cron
- `./tools/security_check.sh` — verify response headers / cookie flags
## Ops helpers
- `./tools/backup.sh` — tarball backup (defaults to `/tmp/www.sillylaird.ca-backups`, override with `BACKUP_DIR`)
- `./tools/uptime_check.sh` — curl-based uptime check (override target with `URL`)
Example cron entries:
```cron
# nightly backup at 03:15 UTC
15 3 * * * BACKUP_DIR=/var/backups/www.sillylaird.ca /path/to/tools/backup.sh
# hourly uptime check
0 * * * * URL=https://www.sillylaird.ca/ /path/to/tools/uptime_check.sh
# daily audits + sitemap regen at 02:30 UTC; mails findings if cron MAILTO is set
30 2 * * * /path/to/tools/run_audits.sh
# pre-commit hook equivalent (run STRICT to fail on findings)
# STRICT=1 /path/to/tools/run_audits.sh
```
## Notes
- `sitemap.xml` is generated by `tools/generate_sitemap.py`.
- No build step: edit `.php` / CSS / JS directly; cache-busting is automatic
via `?v=<filemtime>`.
</content>
</invoke>
|