summaryrefslogtreecommitdiff
path: root/examples/non-html-pages/src/pages/index.astro
blob: 921400acd5781ac778db30dfe03848a43810db53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width" />
		<meta name="generator" content={Astro.generator} />
		<title>Astro</title>
	</head>
	<body>
		<h1 id="result">Loading...</h1>
		<script>
			// Non-HTML files will be included in your final build, so you
			// can fetch them directly in the browser.
			const response = await fetch(`/about.json`);
			const data = await response.json();
			const resultHeader = document.getElementById('result');

			if (resultHeader) {
				resultHeader.innerHTML = `Load complete!<br/>Built with: <a href="${data.url}">${data.name}!</a>`;
			}
		</script>
	</body>
</html>