Templates
The site generator uses Go’s html/template package to render pages. Templates live in site/templates/ and are rendered with data structs populated from the database.
Template Types
Layout Template
layout.html is the base template that all other templates extend. It contains:
<head>with meta tags, title, CSS links- Navigation bar
- Footer
- Common scripts
Page templates inject their content into blocks defined by the layout.
Page Templates
| Template | Page Type |
|---|---|
home.html | Homepage with featured content |
casas_index.html | Scope index (lists all states) |
casas_state.html | State index (lists cities in state) |
city.html | City detail page with local content |
topic_index.html | Topic overview page |
topic_state.html | Topic applied to a state |
topic_city.html | Topic applied to a city |
blog_post.html | Individual blog article |
chat.html | Standalone chat application |
auth_*.html | Authentication pages (login, register, account) |
Data Model
Each template receives a struct with:
type PageData struct { Title string Description string Canonical string StateName string CityName string ScopeName string Content template.HTML Links []Link Meta MetaTags}Content Injection
Pre-rendered HTML content is stored in page_content_cache and injected into templates:
- Generator queries
page_content_cachefor the requested page - If cache miss or stale, generates new content (possibly with AI)
- Renders the template with the cached content block
- Writes the final HTML to
public/
Adding a New Template
- Create the HTML file in
site/templates/ - Add a builder function in
cmd_pages.goor a newcmd_*.go - Register the page type in the CLI command router
- Add data loading logic in
cmd_helper.go - Test with
go run . build-page <new-type>