drop title segment from trend/tech URLs to match Next.js [id] route
This commit is contained in:
parent
5f4782434a
commit
ce42f91a31
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue