Static Site Generation - jegr78/ctc-manager GitHub Wiki

Static Site Generation

CTC Manager generates a complete static HTML website from the current database state, suitable for hosting on GitHub Pages or any static file server.

Overview

Component Class Purpose
Service SiteGeneratorService Renders Thymeleaf templates to static HTML files
Controller SiteGeneratorController Admin UI trigger for site generation
View Models sitegen.model package Data models for the generated pages

Generated Pages

Page Content
Index Landing page with season overview and navigation
Standings Current season team standings table
Driver Rankings Individual driver rankings (season and all-time)
Matchday Pages Per-matchday results with race details
Team Profiles Team page with roster, results, and history
Driver Profiles Individual driver page with race history
Playoff Brackets Visual bracket display for playoff tournaments
Archive Historical season data

Profile URLs

Team and driver profiles live at season/<season>/team/<slug>.html and season/<season>/driver/<slug>.html. The slug is derived from the team short name or PSN ID the first time a profile is generated and then stored, so it stays the same after a rename.

  • Names that slugify alike, such as A_B and A-B, get separate URLs. The profile that already had the URL keeps it, and the newer one gets a -2, -3 suffix.
  • If several profiles shared one URL before slugs were stored, each of them gets a suffixed URL. The shared URL then shows a page linking to all of them, and the generation page lists every such URL as a warning.

Output Directory

The output directory is configurable. Default location:

~/ctc-site-output

In Docker deployments, the output goes to /app/data/site inside the ctc-data named volume.

Triggering Generation

Site generation is triggered manually from the admin UI. The process:

  1. Navigate to the site generation page in the admin panel
  2. Click "Generate" to start the process
  3. All pages are rendered from current database state into a staging directory next to the output directory
  4. Only a complete site replaces the output directory. If generation fails, the previously generated site stays in place, and the error is shown
  5. A second generation started while one is running is rejected. Start it again when the first has finished

GitHub Pages Hosting

The generated static files can be published directly to GitHub Pages:

  1. Generate the site via the admin UI
  2. Copy the output directory contents to a GitHub Pages repository
  3. Push to trigger GitHub Pages deployment

The generated HTML is self-contained and requires no server-side processing.

⚠️ **GitHub.com Fallback** ⚠️