.TH SSG-TEMPLATES 5 "December 2025" "ssg" "File Formats" .SH NAME ssg-templates \- ssg template format .SH DESCRIPTION ssg templates use Go's .B html/template syntax. Each HTML file in the templates directory is processed and rendered to the output directory with the same filename. .SH DATA Data from JSON files in the data directory is made available to templates. Each file becomes a template variable named after the file (without the .I .json extension). .PP For example, if .I data/projects.json contains: .PP .RS .nf [ {"name": "foo", "url": "https://example.com/foo", "featured": true}, {"name": "bar", "url": "https://example.com/bar", "featured": false} ] .fi .RE .PP It can be accessed in templates as .BR .projects : .PP .RS .nf {{range .projects}}
  • {{.name}}
  • {{end}} .fi .RE .SH FUNCTIONS .SS filter The .B filter function returns items from an array where a field equals a value. .PP .RS .nf {{range filter .projects "featured" true}}
  • {{.name}}
  • {{end}} .fi .RE .PP This would output only "foo" since it has .B featured set to .BR true . .SH SYNTAX Templates use Go's text/template syntax: .TP .B {{.field}} Output a field value. .TP .B {{range .items}}...{{end}} Iterate over a list. .TP .B {{if .condition}}...{{end}} Conditional rendering. .TP .B {{with .object}}...{{end}} Set dot to the object for the block. .PP See the Go .B html/template documentation for full syntax details. .SH FILES .TP .I data/*.json JSON data files. Each becomes a template variable. .TP .I templates/*.html HTML templates to render. .SH SEE ALSO .BR ssg (1), .BR ssg-build (1)