Skip to content

Commit

Permalink
Add link to IRLO
Browse files Browse the repository at this point in the history
  • Loading branch information
purplesyringa committed Dec 12, 2024
1 parent e2a93b1 commit 4407aaf
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
31 changes: 17 additions & 14 deletions blog/build-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,27 @@ addFromDir("ru");
posts.sort((a, b) => b.parsedDate - a.parsedDate);

let content = posts.map(post => {
const discussion = post.discussion.map(url => {
const space = (
url.startsWith("https://internals.rust-lang.org") ? "IRLO" :
url.startsWith("https://news.ycombinator.com") ? "Hacker News" :
url.startsWith("https://codeforces.com") ? "Codeforces" :
url.startsWith("https://www.reddit.com") ? "Reddit" :
url.startsWith("https://lobste.rs") ? "Lobsters" :
url.startsWith("https://t.me") ? "Telegram" :
"???"
);
return `<a class="discussion" href="${escapeHTML(url)}"><i class="nf nf-md-comment" title="Comment"></i> ${space}</a>`;
}).join("");
const translation = Object.entries(post.translation || {}).map(([language, url]) => {
return `<a class="discussion" href="${escapeHTML(url)}"><i class="nf nf-md-translate" title="Translation"></i> ${language}</a>`;
}).join("");
return `
<div class="post-entry">
<h2><a href="${escapeHTML(post.path)}/">${escapeHTML(post.title)}</a></h2>
<time>${escapeHTML(post.time)}</time>
${post.discussion.map(url => {
const space = (
url.startsWith("https://news.ycombinator.com") ? "Hacker News" :
url.startsWith("https://codeforces.com") ? "Codeforces" :
url.startsWith("https://www.reddit.com") ? "Reddit" :
url.startsWith("https://lobste.rs") ? "Lobsters" :
url.startsWith("https://t.me") ? "Telegram" :
"???"
);
return `<a class="discussion" href="${escapeHTML(url)}"><i class="nf nf-md-comment" title="Comment"></i> ${space}</a>`;
}).join("")}
${Object.entries(post.translation || {}).map(([language, url]) => {
return `<a class="discussion" href="${escapeHTML(url)}"><i class="nf nf-md-translate" title="Translation"></i> ${language}</a>`;
}).join("")}
${discussion}
${translation}
${md.render(post.intro || "")}
<p>
<a href="${escapeHTML(post.path)}/">Keep reading</a>
Expand Down
13 changes: 7 additions & 6 deletions blog/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ html = html.replace(
/{{ discussion }}/g,
discussion.map(url => {
const space = (
url.startsWith("https://news.ycombinator.com") ? "Hacker News" :
url.startsWith("https://codeforces.com") ? "Codeforces" :
url.startsWith("https://www.reddit.com") ? "Reddit" :
url.startsWith("https://lobste.rs") ? "Lobsters" :
url.startsWith("https://t.me") ? "Telegram" :
"???"
url.startsWith("https://internals.rust-lang.org") ? "IRLO" :
url.startsWith("https://news.ycombinator.com") ? "Hacker News" :
url.startsWith("https://codeforces.com") ? "Codeforces" :
url.startsWith("https://www.reddit.com") ? "Reddit" :
url.startsWith("https://lobste.rs") ? "Lobsters" :
url.startsWith("https://t.me") ? "Telegram" :
"???"
);
return `<a class="discussion" href="${escapeHTML(url)}"><i class="nf nf-md-comment" title="Comment"></i> ${space}</a>`;
}).join("")
Expand Down
Loading

0 comments on commit 4407aaf

Please sign in to comment.