-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPageLayout.astro
More file actions
34 lines (31 loc) · 925 Bytes
/
PageLayout.astro
File metadata and controls
34 lines (31 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
import Head from "@components/Head.astro";
import Header from "@components/Header.astro";
import Footer from "@components/Footer.astro";
import { SITE } from "@consts";
type Props = {
title: string;
description: string;
};
const { title, description } = Astro.props;
// process.env wins so a deployed container can override at runtime (no
// rebuild); import.meta.env covers the `astro dev` / `make dummy-run` path
// where dotenv loads frontend/.env into Vite's env but NOT into process.env.
const apiUrl = process.env.VITE_API_URL || import.meta.env.VITE_API_URL || 'https://api.swissai.svc.cscs.ch';
---
<!doctype html>
<html lang="en">
<head>
<Head title={`${title} | ${SITE.NAME}`} description={description} />
<script define:vars={{ apiUrl }}>
window.__API_URL__ = apiUrl;
</script>
</head>
<body>
<Header />
<main>
<slot />
</main>
<Footer />
</body>
</html>