diff --git a/server/src/html/garden/browse.rs b/server/src/html/garden/browse.rs
index 2d32bbfd428a90df44574221481ada7657df1a80..b7c925f8d8c12bd3454a2d17caa25c769988dc6f 100644
--- a/server/src/html/garden/browse.rs
+++ b/server/src/html/garden/browse.rs
@@ -89,7 +89,7 @@ pub(super) fn scoped_bc_containment(
};
match nav.scope() {
ScopeId::Public => html! {
- a href=(path.slug_root_href()) { "slug.social" }
+ a href="/" { "slug.social" }
(bc_segment("~", "/~", path.is_root()))
(segments)
},
diff --git a/server/src/html/mod.rs b/server/src/html/mod.rs
index 799dde0ba397e47cc48cf2f83be57ffb901b4d4a..a42d8b6320541e5076101fdf26e7920d5262b1c6 100644
--- a/server/src/html/mod.rs
+++ b/server/src/html/mod.rs
@@ -584,6 +584,7 @@ pub(super) fn bc_segment(label: &str, href: &str, is_current: bool) -> Markup {
}
/// Breadcrumb for external ontology `/-/https://…`
+/// Brand goes home (`/` = dark forum) everywhere here — same mode toggle.
fn bc_path_external(path: &ExternalOntologyPath) -> Markup {
html! {
a href="/" { "slug.social" }
@@ -601,16 +602,20 @@ fn bc_path_external(path: &ExternalOntologyPath) -> Markup {
/// Breadcrumb for the garden root (`/~`, the only caller). Deeper tilde pages render
/// the containment breadcrumb (`scoped_bc_containment`); URL segments are not
/// hierarchy — nested inputs redirect to the leaf before any page renders.
+/// Brand is the mode toggle: on the garden root the brand goes home (`/` =
+/// dark forum) instead of to itself.
fn bc_path(path: &OntologyPath) -> Markup {
html! {
- a href=(path.slug_root_href()) { "slug.social" }
+ a href="/" { "slug.social" }
(bc_segment("~", "/~", true))
}
}
/// Render the thread path breadcrumb: `slug.social` on `/`, or `… / threads / #tag` / `… / post #N`.
-/// Brand always points at home (`/`, the thread index). When focusing a post, `#tag` links
-/// to the thread page that contains it (`?offset=` + `#post-N`).
+/// Brand is the mode toggle: on a thread page it goes home (`/` = dark forum);
+/// at root the brand goes to the garden (`/~` = light mode) instead of itself.
+/// When focusing a post, `#tag` links to the thread page that contains it
+/// (`?offset=` + `#post-N`).
pub(super) fn bc_threads(thread_tag: Option<&str>, focused_post: Option) -> Markup {
let nav = ThreadNav::public();
html! {
@@ -628,7 +633,7 @@ pub(super) fn bc_threads(thread_tag: Option<&str>, focused_post: Option)
(bc_segment(&format!("#{tag}"), &nav.thread_url(tag), true))
}
} @else {
- a href="/" class="bc-current" { "slug.social" }
+ a href="/~" { "slug.social" }
}
}
}
diff --git a/server/tests/integration_html.rs b/server/tests/integration_html.rs
index d174c97be262d2660ad46671eb831e9b4b1cf3ef..bcfb62eb25dc7897b5484e3ac4113aadb9b93aac 100644
--- a/server/tests/integration_html.rs
+++ b/server/tests/integration_html.rs
@@ -678,6 +678,67 @@ async fn test_home_empty_garden_has_honest_empty_state() {
assert!(!body.contains("data-testid=\"question-index\""));
}
+#[tokio::test]
+async fn test_brand_is_mode_toggle_home_goes_garden_elsewhere_goes_home() {
+ let (addr, _tmp, _log, state, _handle) = create_test_server_with_state().await;
+ {
+ let mut w = state.reduced.write().await;
+ // Garden needs a voteless item with a body to render.
+ w.apply_event(Event::Ingest(Ingest {
+ ts: 7,
+ id: "ing-brand-toggle-item".into(),
+ raw: "~/toggle-me {a kept item}".into(),
+ principal: "testuser".into(),
+ delegate: None,
+ room_id: "public".into(),
+ thread_tag: "toggle-thread".into(),
+ }));
+ }
+ let client = reqwest::Client::new();
+ // Root: dark forum. Brand teleports to light mode — the garden, not itself.
+ let home = client
+ .get(format!("http://{addr}/"))
+ .send()
+ .await
+ .unwrap()
+ .text()
+ .await
+ .unwrap();
+ assert!(
+ home.contains("href=\"/~\">slug.social<"),
+ "at root the brand must go to the garden (light mode): {}",
+ home.chars().take(1200).collect::()
+ );
+ // Thread page: brand goes home (dark forum).
+ let thread = client
+ .get(format!("http://{addr}/t/toggle-thread"))
+ .send()
+ .await
+ .unwrap()
+ .text()
+ .await
+ .unwrap();
+ assert!(
+ thread.contains("href=\"/\">slug.social<"),
+ "on a thread the brand must go home: {}",
+ thread.chars().take(1200).collect::()
+ );
+ // Garden item page: brand goes home (dark forum).
+ let garden = client
+ .get(format!("http://{addr}/~/toggle-me"))
+ .send()
+ .await
+ .unwrap()
+ .text()
+ .await
+ .unwrap();
+ assert!(
+ garden.contains("href=\"/\">slug.social<"),
+ "on a garden item the brand must go home: {}",
+ garden.chars().take(1200).collect::()
+ );
+}
+
#[tokio::test]
async fn test_home_index_caps_at_ten_but_old_thread_url_stays() {
let (addr, _tmp, _log, state, _handle) = create_test_server_with_state().await;