@@ -8,6 +8,7 @@ type loaderData = {
88 blogPost ?: BlogApi .post ,
99 mdxSources ?: array <SyntaxLookup .item >,
1010 activeSyntaxItem ?: SyntaxLookup .item ,
11+ breadcrumbs ?: list <Url .breadcrumb >,
1112}
1213
1314/**
@@ -205,11 +206,31 @@ let loader: Loader.t<loaderData> = async ({request}) => {
205206 })
206207 -> Array .slice (~start = 2 ) // skip first two entries which are the document entry and the H1 title for the page, we just want the h2 sections
207208
209+ let breadcrumbs =
210+ pathname -> String .includes ("docs/manual" )
211+ ? Some (list {
212+ {Url .name : "Docs" , href : "/docs/" },
213+ {
214+ Url .name : "Language Manual" ,
215+ href : "/docs/manual/" ++ "introduction" ,
216+ },
217+ })
218+ : pathname -> String .includes ("docs/react" )
219+ ? Some (list {
220+ {Url .name : "Docs" , href : "/docs/" },
221+ {
222+ Url .name : "rescript-react" ,
223+ href : "/docs/react/" ++ "introduction" ,
224+ },
225+ })
226+ : None
227+
208228 let res : loaderData = {
209229 __raw : mdx .__raw ,
210230 attributes : mdx .attributes ,
211231 entries ,
212232 categories ,
233+ ?breadcrumbs ,
213234 }
214235
215236 res
@@ -239,7 +260,12 @@ let default = () => {
239260 (pathname :> string )-> String .includes ("docs/manual" ) ||
240261 (pathname :> string )-> String .includes ("docs/react" )
241262 ) {
242- <DocsLayout metaTitleCategory categories activeToc = {title : "Introduction" , entries }>
263+ <DocsLayout
264+ metaTitleCategory
265+ categories
266+ activeToc = {title : "Introduction" , entries }
267+ breadcrumbs = ?loaderData .breadcrumbs
268+ >
243269 <di1v className = "markdown-body" > {component ()} </di1v >
244270 </DocsLayout >
245271 } else if (pathname :> string )-> String .includes ("community" ) {
0 commit comments