Skip to content

Commit a1f5d60

Browse files
committed
Fix
1 parent d73fc9d commit a1f5d60

5 files changed

Lines changed: 7 additions & 6 deletions

File tree

js/blog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ window.addEventListener("popstate", e => {
118118
/* -------------------- Initialization -------------------- */
119119

120120
// Fetch posts and initialize the page
121-
fetch("/posts/metadata/entries.json")
121+
fetch("./posts/metadata/entries.json")
122122
.then(response => response.json())
123123
.then(data => {
124124
posts = data;

js/comments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ document.addEventListener("DOMContentLoaded", () => {
2323

2424
// load existing
2525
fetch(`/api/comments?slug=${slug}`)
26-
.then(r => r.json())
26+
.then(r => r.ok ? r.json() : [])
2727
.then(arr => {
2828
if (!arr.length) {
2929
commentsList.innerHTML =

js/post.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import jsYaml from 'js-yaml';
2-
31
function parseFrontMatter(md) {
42
const re = /^---\r?\n([\s\S]+?)\r?\n---(?:\r?\n|$)/;
53
const m = re.exec(md);
@@ -29,7 +27,7 @@ if (!content) {
2927
throw new Error("Required DOM element not found.");
3028
}
3129

32-
fetch(`/posts/entries/${slug}.md`)
30+
fetch(`./posts/entries/${slug}.md`)
3331
.then(r => r.text())
3432
.then(md => {
3533
const { meta, body } = parseFrontMatter(md);

js/projects.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ function createLanguageBar(languages) {
3737
async function fetchLanguages(repo) {
3838
if (langCache.has(repo)) return langCache.get(repo);
3939

40-
const resp = await fetch(`/api/github-languages?repo=${repo}`);
40+
const url = `https://api.github.com/repos/${repo}/languages`;
41+
const resp = await fetch(url);
42+
4143
if (!resp.ok) {
4244
console.warn(`Could not load languages for ${repo}: ${resp.status}`);
4345
langCache.set(repo, {});

post.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ <h3>Add a Comment</h3>
5555
<script src="js/mathjax.js"></script>
5656
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script>
5757
<script type="module" src="js/header-footer.js"></script>
58+
<script src="https://cdn.jsdelivr.net/npm/js-yaml@4/dist/js-yaml.min.js"></script>
5859
<script type="module" src="js/post.js"></script>
5960
<script src="js/comments.js"></script>
6061
</body>

0 commit comments

Comments
 (0)