diff --git a/website/src/pages/doc.gleam b/website/src/pages/doc.gleam index 48be6acb..9362ca84 100644 --- a/website/src/pages/doc.gleam +++ b/website/src/pages/doc.gleam @@ -16,7 +16,11 @@ import jot import post import util -pub fn page(p: post.Post, doc_pages_list) -> element.Element(a) { +pub fn page( + p: post.Post, + this_slug: String, + doc_pages_list, +) -> element.Element(a) { html.div([attribute.class("flex-auto flex flex-col overflow-none")], [ html.div( [ @@ -103,16 +107,37 @@ pub fn page(p: post.Post, doc_pages_list) -> element.Element(a) { }) |> list.first() [ - html.li([attribute.class("font-bold")], [ - html.a( - [ - attribute.href(conf.base_url_join( - { parent_post.1 }.slug, - )), - ], - [element.text({ parent_post.1 }.title)], - ), - ]), + html.li( + [ + attribute.class( + "font-bold" + <> case this_slug == { parent_post.1 }.slug { + False -> { + "" + } + True -> " text-pink-400" + }, + ), + ], + [ + html.a( + [ + attribute.href(conf.base_url_join( + { parent_post.1 }.slug, + )), + ], + [ + element.text( + case this_slug == { parent_post.1 }.slug { + False -> "" + True -> " -> " + } + <> { parent_post.1 }.title, + ), + ], + ), + ], + ), case list.length(group.1) { 1 -> element.none() _ -> @@ -123,12 +148,33 @@ pub fn page(p: post.Post, doc_pages_list) -> element.Element(a) { { p1.1 }.title != { parent_post.1 }.title }) |> list.map(fn(post: #(String, post.Post)) { - html.li([attribute.class("mb-2")], [ - html.a( - [attribute.href(conf.base_url_join(post.0))], - [element.text({ post.1 }.title)], - ), - ]) + html.li( + [ + attribute.class( + "mb-2" + <> case this_slug == { post.1 }.slug { + False -> { + "" + } + True -> " text-pink-400" + }, + ), + ], + [ + html.a( + [attribute.href(conf.base_url_join(post.0))], + [ + element.text( + case this_slug == { post.1 }.slug { + False -> "" + True -> " -> " + } + <> { post.1 }.title, + ), + ], + ), + ], + ) }), ) }, diff --git a/website/src/website.gleam b/website/src/website.gleam index be3b2feb..7eea0cf3 100644 --- a/website/src/website.gleam +++ b/website/src/website.gleam @@ -35,7 +35,6 @@ pub fn main() { _ -> slug } - io.debug(path) let assert Ok(content) = simplifile.read(path) let frontmatter = djot.frontmatter(content) let metadata = case frontmatter { @@ -82,10 +81,10 @@ pub fn main() { |> ssg.add_static_route("/", create_page(index.page())) |> list.fold(posts, _, fn(config, post) { let page = case is_doc_page(post.0) { - True -> doc.page(post.1, doc_pages) - False -> doc.page(post.1, doc_pages) + True -> doc.page(post.1, post.0, doc_pages) + False -> doc.page(post.1, post.0, doc_pages) } - io.debug(post.0) + //io.debug(post.0) ssg.add_static_route(config, post.0, create_page(page)) }) |> ssg.use_index_routes