-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
62 lines (57 loc) · 1.61 KB
/
index.html
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html lang="en">
<head>
<title>Home</title>
<meta name="google-site-verification" content="gaM3C45hv4VJ_hib8CIvTXuOBE0m4PhercsYA4tHg3g" />
</head>
<body>
<article>
<ul id="posts"></ul>
</article>
</body>
<script constexpr src="/static/js/constexpr/lib.js"></script>
<script constexpr src="/static/js/constexpr/renderer.js"></script>
<script constexpr>
async function page_specific_stuff() {
['/projects.html', '/tags.html', '/404.html', '/about.html'].map(path => window._ConstexprJS_.addPath({
generator: path,
output: path
}))
const postsEl = document.querySelector('#posts')
const posts = await fetch('/collections/posts.json').then(res => res.json())
posts.forEach(post => window._ConstexprJS_.addPath({
generator: post.url,
output: post.url
}))
posts
.filter(p => window._ConstexprJS_.DEV ? true : !p.draft)
.forEach(post => {
let tags = ''
post.tags.forEach(tag => {
tags += `<a class="tag_element" href="/tags/generator.html?${tag}">${tag}</a> `
})
const el = make_element(`
<li><div class="post_card">
<a style="display: block;" href="${post.url}"><h3>${post.title}</h3></a>
<div>${tags}</div>
<div class="post_description">${post.description}</div>
</div></li>`)
postsEl.prepend(el)
})
}
</script>
<script constexpr>
(async function () {
await site_global_rendering()
await page_specific_stuff()
window._ConstexprJS_.compile()
})()
</script>
<style>
#posts {
margin-top: 2em;
padding: 0;
list-style-type: none;
}
</style>
</html>