Skip to content

Commit 5d867e4

Browse files
committed
Enable frontmatter for latest manual layout
1 parent cfb9ea8 commit 5d867e4

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

common/App.re

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ type props = {
4242
"pageProps": pageProps,
4343
};
4444

45-
[@bs.get] external frontmatter: React.component(Js.t({.})) => Js.Json.t = "frontmatter";
45+
[@bs.get]
46+
external frontmatter: React.component(Js.t({.})) => Js.Json.t =
47+
"frontmatter";
4648

4749
let default = (props: props): React.element => {
4850
let component = props##"Component";
@@ -59,11 +61,14 @@ let default = (props: props): React.element => {
5961
| {base: [|"docs", "manual"|], version} =>
6062
switch (version) {
6163
| Latest =>
62-
<ManualDocsLayout.Prose> content </ManualDocsLayout.Prose>
64+
<ManualDocsLayout.Prose frontmatter={component->frontmatter}>
65+
content
66+
</ManualDocsLayout.Prose>
6367
| Version("v8.0.0") =>
64-
<ManualDocsLayout8_0_0.Prose frontmatter=component->frontmatter> content </ManualDocsLayout8_0_0.Prose>
65-
| _ =>
66-
React.null
68+
<ManualDocsLayout8_0_0.Prose frontmatter={component->frontmatter}>
69+
content
70+
</ManualDocsLayout8_0_0.Prose>
71+
| _ => React.null
6772
}
6873
| {base: [|"docs", "reason-compiler"|], version: Latest} =>
6974
<ReasonCompilerDocsLayout> content </ReasonCompilerDocsLayout>

layouts/DocsLayout.re

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ let make =
395395
++ version
396396
++ "/"
397397
++ Js.Array2.joinWith(url.pagepath, "/");
398-
Js.log2("targetUrl", targetUrl);
399398
router->Next.Router.push(targetUrl);
400399
};
401400
<VersionSelect

layouts/ManualDocsLayout.re

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ let categories = [|
141141

142142
module Docs = {
143143
[@react.component]
144-
let make = (~components=Markdown.default, ~children) => {
144+
let make =
145+
(
146+
~frontmatter: option(Js.Json.t)=?,
147+
~components=Markdown.default,
148+
~children,
149+
) => {
145150
let router = Next.Router.useRouter();
146151
let route = router.route;
147152

@@ -188,6 +193,7 @@ module Docs = {
188193
title
189194
availableVersions=allManualVersions
190195
latestVersionLabel
196+
?frontmatter
191197
?activeToc
192198
?breadcrumbs>
193199
children
@@ -197,7 +203,7 @@ module Docs = {
197203

198204
module Prose = {
199205
[@react.component]
200-
let make = (~children) => {
201-
<Docs components=Markdown.default> children </Docs>;
206+
let make = (~frontmatter: option(Js.Json.t)=?, ~children) => {
207+
<Docs ?frontmatter components=Markdown.default> children </Docs>;
202208
};
203209
};

layouts/ManualDocsLayout8_0_0.re

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ let jsInteropNavs = [|
9494
href: "/docs/manual/v8.0.0/bind-to-global-js-values",
9595
},
9696
{name: "JSON", href: "/docs/manual/v8.0.0/json"},
97+
{
98+
name: "Use Illegal Identifier Names",
99+
href: "/docs/manual/latest/use-illegal-identifier-names",
100+
},
97101
{
98102
name: "Browser Support & Polyfills",
99103
href: "/docs/manual/v8.0.0/browser-support-polyfills",
@@ -191,7 +195,7 @@ module Docs = {
191195
{(
192196
"You are currently looking at the "
193197
++ version
194-
++ " docs. You can find the latest manual page "
198+
++ " docs (Reason v3.6 syntax edition). You can find the latest manual page "
195199
)
196200
->s}
197201
<A href=latestUrl> "here"->s </A>

0 commit comments

Comments
 (0)