54 lines
1.6 KiB
HTML
54 lines
1.6 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Hex Studios</title>
|
|
<link rel="stylesheet" href="styles/main.css">
|
|
</head>
|
|
<body>
|
|
<h1>// Hex Studios</h1>
|
|
<i>Developer, biker, musician, engineer, and an unapologetic centrist in the deep red south. The real @hexstudios.</i>
|
|
|
|
<div id="stick-posts-section">
|
|
<h2>Pinned posts</h2>
|
|
<ul>
|
|
<li><a href="posts/about.html">About Hex Studios</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div id="posts-section">
|
|
<h2>Posts</h2>
|
|
<ul id="posts-list"></ul>
|
|
</div>
|
|
|
|
<script>
|
|
async function loadPosts() {
|
|
const list = document.getElementById('posts-list');
|
|
try {
|
|
const res = await fetch('posts/list.php');
|
|
const posts = await res.json();
|
|
|
|
if (!posts.length) {
|
|
list.innerHTML = '<li>No posts yet.</li>';
|
|
return;
|
|
}
|
|
|
|
posts.forEach(post => {
|
|
const li = document.createElement('li');
|
|
const a = document.createElement('a');
|
|
a.textContent = post.title;
|
|
a.href = post.type === 'html'
|
|
? 'posts/' + post.file
|
|
: 'post.html?file=' + encodeURIComponent(post.file);
|
|
li.appendChild(a);
|
|
list.appendChild(li);
|
|
});
|
|
} catch (err) {
|
|
list.innerHTML = '<li>Couldn\u2019t load posts.</li>';
|
|
}
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', loadPosts);
|
|
</script>
|
|
</body>
|
|
</html> |