File tree Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,21 @@ let default = () => {
305305 <DocsLayout
306306 categories
307307 activeToc = {title : "Introduction" , entries }
308- breadcrumbs = ?loaderData .breadcrumbs
308+ breadcrumbs = ?{loaderData .breadcrumbs -> Option .map (crumbs =>
309+ List .mapWithIndex (crumbs , (item , index ) => {
310+ if index === 0 {
311+ if (pathname :> string )-> String .includes ("docs/manual" ) {
312+ {... item , href : "/docs/manual/introduction" }
313+ } else if (pathname :> string )-> String .includes ("docs/react" ) {
314+ {... item , href : "/docs/react/introduction" }
315+ } else {
316+ item
317+ }
318+ } else {
319+ item
320+ }
321+ })
322+ )}
309323 editHref = {` https://github.com/rescript-lang/rescript-lang.org/blob/master${loaderData.filePath-> Option.getOrThrow}` }
310324 >
311325 <div className = "markdown-body" > {component ()} </div >
Original file line number Diff line number Diff line change 11@react.component
22let default = () => {
3+ let {pathname } = ReactRouter .useLocation ()
4+ let navigate = ReactRouter .useNavigate ()
5+
6+ React .useEffect (() => {
7+ if (pathname :> string )-> String .includes ("/react/" ) {
8+ navigate ("/docs/react/introduction" )
9+ }
10+ if (pathname :> string )-> String .includes ("/docs/" ) {
11+ navigate ("/docs/manual/introduction" )
12+ }
13+ None
14+ }, [])
15+
316 <div className = "pt-36 text-center flex flex-col gap-6 text-gray-80 w-fit mx-auto" >
417 <h1 className = "hl-title" > {React .string ("404" )} </h1 >
518 <h2 className = "text-32" > {React .string ("Page Not Found" )} </h2 >
Original file line number Diff line number Diff line change @@ -377,7 +377,7 @@ let make = (props: props) => {
377377 let breadcrumbs = ApiLayout .makeBreadcrumbs (~prefix , route )
378378
379379 <SidebarLayout
380- breadcrumbs = {list {{Url .name : "Docs" , href : "/docs/manual/introduction " }, ... breadcrumbs }}
380+ breadcrumbs = {list {{Url .name : "Docs" , href : "/docs/manual/api " }, ... breadcrumbs }}
381381 theme = #Reason
382382 sidebarState = (isSidebarOpen , setSidebarOpen )
383383 sidebar
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ module Docs = {
2424 let {pathname : route } = ReactRouter .useLocation ()
2525
2626 let breadcrumbs = list {
27- {Url .name : "Docs" , href : ` /docs/manual/introduction ` },
27+ {Url .name : "Docs" , href : ` /docs/manual/api ` },
2828 {name : "API" , href : ` /docs/manual/api` },
2929 }
3030
You can’t perform that action at this time.
0 commit comments