update readme for using the preview script

This commit is contained in:
2026-06-06 19:34:44 +00:00
Unverified
parent 835b118d1a
commit 4f78224ca6

View File

@@ -13,16 +13,33 @@ This project is a website built with **Hugo v0.162.1 Extended** and the **Blowfi
## 🚀 Local Development ## 🚀 Local Development
To run the development server, run the following command in the terminal: To preview the wiki contents locally, you should use the `preview.sh` script to run the development server for either the public or private documentation.
### Launching the Preview
Run the script from the project root with the target environment (`public` or `private`) as the argument:
```bash ```bash
./run-dev.sh # Preview the public wiki
./preview.sh public
# Preview the private wiki
./preview.sh private
``` ```
The script will launch a server bound to `0.0.0.0:1313` with the correct `baseURL` and configuration flags to make it accessible via code-server's absolute proxy: The script automatically handles mounting the content, configures the build, and starts the server. Once running, the site is accessible via code-server's absolute proxy:
👉 **[https://dev.wompmacho.com/absproxy/1313/](https://dev.wompmacho.com/absproxy/1313/)** 👉 **[https://dev.wompmacho.com/absproxy/1313/](https://dev.wompmacho.com/absproxy/1313/)**
### How it Works (Under the Hood)
The `preview.sh` script automates the framework's connection to your external content repository files:
1. **Directory Symlinking**: It deletes the framework's default `content/` and `static/` directories and symlinks them directly to their counterparts in the content repository (`/srv/docs/public` or `/srv/docs/private`).
2. **Configuration Overrides**: If a custom menu configuration (`config/_default/menus.en.toml`) exists inside the content directory, it symlinks it to override the framework's default menu structure.
3. **Dev Server Launch**: It runs `./run-dev.sh` to start the Hugo development server (which removes the output `public/` directory first to prevent caching conflicts and renders to memory at `0.0.0.0:1313`).
4. **Graceful Cleanup Trap**: When the process is interrupted or terminated (e.g., via `Ctrl+C`), a shell `trap` catches the signal, removes the temporary preview symlinks, and performs a `git checkout` to restore the framework's original repository defaults cleanly.
> [!NOTE] > [!NOTE]
> The dev script automatically removes the `public/` folder before launching. This prevents browser caching conflicts and ensures that the server builds dynamically in-memory with correct proxy URLs. > Do not manually commit symlinks or edited framework configurations while running the preview server. Let the script cleanly exit and restore repository defaults.
--- ---