Skip to content

Commit

Permalink
Reverse the order of the page title
Browse files Browse the repository at this point in the history
  • Loading branch information
bitspittle committed Feb 27, 2025
1 parent c37fba1 commit c9160ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,17 @@ fun DocsLayout(content: @Composable () -> Unit) {
val ctx = rememberPageContext()

val articleHandle = ctx.markdown?.let { ctx.route.toArticleHandle() }
val title = buildString {
append("Docs")
val title = buildList {
if (articleHandle != null) {
append(" - ${articleHandle.category.title}")
articleHandle.subcategory.title.takeIf { it.isNotEmpty() }?.let { append(" - $it") }
articleHandle.article.title.takeIf { it.isNotEmpty() }?.let { append(" - $it") }
articleHandle.article.title.takeIf { it.isNotEmpty() }?.let { add(it) }
articleHandle.subcategory.title.takeIf { it.isNotEmpty() }?.let { add(it) }
articleHandle.category.title.takeIf { it.isNotEmpty() }?.let { add(it) }
}
}

if (this.isEmpty()) {
add("Docs")
}
}.joinToString(" - ")

PageLayout(title) {
MobileLocalNav()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.jetbrains.compose.web.dom.Div
@Composable
fun PageLayout(title: String, content: @Composable () -> Unit) {
LaunchedEffect(title) {
document.title = "Kobweb - $title"
document.title = "$title | Kobweb"
}

val ctx = rememberPageContext()
Expand Down

0 comments on commit c9160ab

Please sign in to comment.