4. More pages
A page is one entry in the tree — nothing else. pages/about.templ:
package pages
templ About(title string, path string, prefix string) {
@Layout(title, path, prefix) {
<h1>About</h1>
<p>This site is built with astwerk.</p>
}
}And one entry in the tree:
root := ssg.Node{
Title: "My Site",
Page: ssg.Templ(pages.Home),
Children: map[string]ssg.Node{
"about": {Title: "About", Page: ssg.Templ(pages.About)},
},
}That writes build/about/index.html. The Title is what the walker hands the page as its title argument — every page gets its title, path and locale from the tree it lives in.
Try it. Add a third page — say contact — as one more Children entry.
What you should see
build/contact/index.html appears and nothing else changes. A page really is one entry in the tree.
What does adding a page require?
A page is one entry in the tree — nothing else. The walker derives the page's title, path and locale from where it lives.
What does one Children entry produce?
Each Children key becomes a directory, and the node's Page renders its index.html — build/about/index.html comes from one map entry.