Post not found.";
return;
}
const res = await fetch(
`https://api.github.com/repos/${repo}/contents/posts`,
);
const files = res.ok
? (await res.json()).filter((f) => f.name.endsWith(".md"))
: [];
app.innerHTML = files.length
? files
.reverse()
.map((f) => {
const s = f.name.replace(/\.md$/, "");
return `${s.replace(/[-_]/g, " ")}`;
})
.join("")
: " No markdown files in posts/ yet.";
}
window.onhashchange = render;
render();