Skip to content

Commit 7b0345c

Browse files
committed
Add index page
1 parent 4b9c56f commit 7b0345c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

index.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>STAC API - Children</title>
6+
<style>
7+
body {
8+
font-family: sans-serif;
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
<h1>STAC API - Children</h1>
14+
<ul id="schema-list">
15+
</ul>
16+
<script type="text/javascript">
17+
(async () => {
18+
const response = await fetch(`https://api.github.com/repos/stac-api-extensions/children/git/trees/gh-pages?recursive=true`);
19+
const data = await response.json();
20+
schemas = data.tree
21+
.filter(f => f.path.startsWith('v') && f.type === 'blob')
22+
.sort((a, b) => a.path.localeCompare(b.path));
23+
// Create a list of links to each file,grouped by folder / version
24+
let htmlString = '';
25+
let currentVersion = '';
26+
schemas.forEach(schema => {
27+
const [version, filename] = schema.path.split('/', 2);
28+
if (version !== currentVersion) {
29+
if (currentVersion !== '') {
30+
htmlString += '</ul>';
31+
}
32+
currentVersion = version;
33+
htmlString += `<li><strong>${version}</strong><ul>`;
34+
}
35+
htmlString += `<li><a href="${schema.path}" target="_blank">${filename}</a></li>`;
36+
});
37+
38+
document.getElementById('schema-list').innerHTML = htmlString;
39+
})();
40+
</script>
41+
</body>
42+
</html>

0 commit comments

Comments
 (0)