drop title segment from trend/tech URLs to match Next.js [id] route

This commit is contained in:
Mohamad Mahdi Jebeli 2026-06-21 10:20:25 +03:30
parent 5f4782434a
commit ce42f91a31
1 changed files with 6 additions and 3 deletions

View File

@ -530,7 +530,10 @@ class HomeWidgetRepository {
} else if (localData.id != null && } else if (localData.id != null &&
localData.id.toString().isNotEmpty) { localData.id.toString().isNotEmpty) {
String url = ""; String url = "";
String title = localData.title?.split(" ").join("-") ?? ""; // Note: previously these URLs appended `/$title` as a slug,
// but the Next.js trend/tech pages only have a single
// dynamic `[id]` segment adding a second segment makes
// the page 404. URLs are now built with id only.
switch (localData.type) { switch (localData.type) {
case "startup": case "startup":
@ -539,11 +542,11 @@ class HomeWidgetRepository {
break; break;
case "technology": case "technology":
url = url =
"https://tech.didvan.app/technology/${localData.id}/$title?accessToken=${RequestService.token}"; "https://tech.didvan.app/technology/${localData.id}?accessToken=${RequestService.token}";
break; break;
case "trend": case "trend":
url = url =
"https://trend.didvan.app/trend/${localData.id}/$title?accessToken=${RequestService.token}"; "https://trend.didvan.app/trend/${localData.id}?accessToken=${RequestService.token}";
break; break;
} }