PureWiki handles user requests for content (the public wiki) using an efficient routing and rendering engine. This guide explains how the system translates a URL into a fully realized HTML page.
The Router (index.php)
Every request passes through index.php. It normalizes the requested URL and determines if the path points to /setup, a dashboard route, or a regular wiki page.
Rendering Pipeline:
Public requests are delegated to the frontend rendering system (
purewiki/frontend/renderer.php).The Rendering Engine
The renderPage() function is the core of PureWiki generation. It handles:
- Data Extraction: Parses the
page.jsonto retrieve metadata and blocks. - Content Parsing: Blocks are converted into semantic HTML via
purewiki/frontend/parser.php. - Theme Injection: The aggregated data and HTML content are passed to the active theme template.
- Placeholder Replacement: Replaces specialized placeholders (e.g.,
{{ content }},{{ assets_head }}) within the theme's output.
The Caching Mechanism (/cache)
To deliver lightning-fast response times, PureWiki uses a robust static HTML caching system.
Cache:
For unauthenticated users, static HTML files are served, bypassing PHP processing and JSON parsing.
Note:
Caching is explicitly disabled for authenticated users to always show the most up-to-date content during active editing.
Sitemap (sitemap.xml)
PureWiki dynamically generates a sitemap.xml to aid search engine indexing. It is served from the wiki root and follows the sitemaps.org standard.
Generation Logic:
The sitemap traverses the page tree (
getCachedPagesTree()) and automatically excludes private pages. Priority is dynamically calculated based on page depth.