# ~jisifu Website — Agents Guide Architecture, operations, and reference for AI agents and developers maintaining this site. --- ## Table of Contents - [Architecture: Aki JSON Pattern](#architecture-aki-json-pattern) - [System Flow](#system-flow) - [JSON DOM Enhancement Pattern](#json-dom-enhancement-pattern) - [Directory Structure](#directory-structure) - [German Section Architecture](#german-section-architecture) - [Component Reference](#component-reference) - [Build Pipeline](#build-pipeline) - [Operations](#operations) - [CI Pipeline](#ci-pipeline) - [Optimizations](#optimizations) - [Troubleshooting](#troubleshooting) - [Changelog Summary](#changelog-summary) --- ## Architecture: Aki JSON Pattern This website follows the **Aki architecture** (inspired by [Aki](https://github.com/vilgacx/aki)), which uses a "JSON-as-data" approach to create a fast, Single-Page Application (SPA) experience without a heavy framework. ### Core Principle Instead of full page reloads, the frontend fetches JSON objects from the server. These objects contain the HTML content, which is dynamically injected into the DOM using simple JavaScript selectors. ### System Flow ``` Browser Request → nginx → route file exists? (e.g., german/index.php) YES → serve route file → includes ../index.php → HTML shell + JS NO → 404 (should not happen for existing sections) JS on page load parses window.location.pathname: /german → fetch public/german/index.json /blog/post → fetch public/blog/post.json / → fetch public/home/index.json ↓ ┌──────────────────────────────────────┐ │ generate_json.php (build step) │ │ Reads content/*.md │ │ Renders to HTML via comrak │ │ Wraps in JSON → public/*/index.json │ └──────────────────────────────────────┘ ↑ content/*/index.md (source of truth) ↓ ┌──────────────────────────────────────┐ │ generate_routes.php (build step) │ │ Creates route files for nginx: │ │ german/index.php → requires ../index.php │ │ blog/post/index.php → requires ../../index.php │ └──────────────────────────────────────┘ ``` ### JSON Structure Generated JSON files in `public/` follow this format: ```json { "html": {"scrollTop": 0}, "body": {"scrollTop": 0}, "#panel": {"tabIndex": -1}, "#grammar": {"open": true}, "meta": { "title": "Page Title", "description": "Optional meta description" }, "section": { "innerHTML": "
Content...
" } } ``` The frontend JavaScript iterates through the keys, finds corresponding DOM elements via `document.querySelector(key)`, and updates their properties (e.g., `innerHTML`, `open`, `scrollTop`). The `meta` key is specially handled for `