Skip to content

Commit 9f53c24

Browse files
Move sub-pages into their own directories
1 parent e4c1784 commit 9f53c24

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/build.gleam

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ pub fn main() {
1717
let build =
1818
ssg.new("./priv")
1919
|> ssg.add_static_route("/", index.view())
20-
|> ssg.add_static_route("/about", about.view())
21-
|> ssg.add_static_route("/commissions", commissions.view())
22-
|> ssg.add_static_route("/contact", contact.view())
20+
|> add_static_route("/about", about.view())
21+
|> add_static_route("/commissions", commissions.view())
22+
|> add_static_route("/contact", contact.view())
2323
|> ssg.add_static_dir("./static")
24-
|> ssg.add_static_route("/projects/index", projects_page.view(categories))
24+
|> add_static_route("/projects", projects_page.view(categories))
2525
|> add_dynamic_routes(
2626
categories,
2727
project.view,
@@ -50,3 +50,11 @@ fn add_dynamic_routes(
5050
let #(base, dict) = map_fn(element)
5151
ssg.add_dynamic_route(config, base, dict, view)
5252
}
53+
54+
fn add_static_route(
55+
config: ssg.Config(a, b, c),
56+
route: String,
57+
view: Element(d),
58+
) -> ssg.Config(ssg.HasStaticRoutes, b, c) {
59+
ssg.add_static_route(config, route <> "/index", view)
60+
}

0 commit comments

Comments
 (0)