File tree Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ let default = () => {
320320 }
321321 })
322322 )}
323- editHref = {` https://github.com/rescript-lang/rescript-lang.org/blob/master ${loaderData.filePath-> Option.getOrThrow}` }
323+ editHref = {` https://github.com/rescript-lang/rescript-lang.org/blob/${Env.github_branch} ${loaderData.filePath-> Option.getOrThrow}` }
324324 >
325325 <div className = "markdown-body" > {component ()} </div >
326326 </DocsLayout >
Original file line number Diff line number Diff line change 7676 "vite-plugin-devtools-json" : " ^1.0.0" ,
7777 "vite-plugin-env-compatible" : " ^2.0.1"
7878 }
79- }
79+ }
Original file line number Diff line number Diff line change 1+ // If Vite if running in dev mode
2+ external dev : bool = "import.meta.env.DEV"
3+
4+ // Cloudflare deployment URL
5+ external deployment_url : option <string > = "import.meta.env.DEPLOYMENT_URL"
6+
7+ // The current github branch
8+ external github_branch : option <string > = "import.meta.env.GITHUB_BRANCH"
9+ let github_branch = switch github_branch {
10+ | Some (branch ) => branch
11+ | None => "master"
12+ }
13+
14+ // the root url of the site, e.g. "https://rescript-lang.org/" or "http://localhost:5173/"
15+ let root_url = switch deployment_url {
16+ | Some (url ) => url
17+ | None => dev ? "http://localhost:5173/" : "https://rescript-lang.org/"
18+ }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ let make = (
1515 ~ogImage = "/Art-3-rescript-launch.jpg" ,
1616 ~version : option <Url .version >= ?,
1717) => {
18- let ogImage = "https://rescript-lang.org" ++ ogImage
18+ let ogImage = Env . root_url ++ ogImage
1919
2020 let title = switch title {
2121 | None
You can’t perform that action at this time.
0 commit comments