Skip to content

Commit 4ba9c04

Browse files
committed
Update README.md
1 parent 165c50e commit 4ba9c04

3 files changed

Lines changed: 29 additions & 13 deletions

File tree

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,33 @@ This repository contains the source code for my personal website. The site serve
66

77
- **Blog**: Posts about various topics, including school, life, and random ideas.
88
- **Projects**: A showcase of personal projects and experiments.
9-
- **Comments**: Visitors can leave comments on posts, with support for author names and timestamps.
9+
- **Comments**: Visitors can leave comments on blog posts, with support for author names and timestamps.
1010
- **Dark Mode**: Toggle between light and dark themes.
1111
- **Math Support**: Render mathematical expressions using MathJax.
1212
- **Markdown Parsing**: Blog posts are written in Markdown and rendered dynamically.
13+
- **Notes**: Course notes rendered from Markdown (with front-matter), featuring MathJax support and an auto-generated table of contents.
1314
- **Pagination & Filtering**: Browse posts by tag or search with pagination.
1415

1516
## Tech Stack
1617

1718
- **Frontend**: HTML, CSS, JavaScript (Vanilla)
18-
- **Libraries**:
19-
- [Marked.js](https://github.com/markedjs/marked) — Markdown parsing
20-
- [MathJax](https://www.mathjax.org/) — Math rendering in posts
21-
- [DOMPurify](https://github.com/cure53/DOMPurify) — HTML sanitization for user-generated content
22-
- **Backend**: Node.js (serverless functions via Vercel)
23-
- Dynamic comment storage using either:
24-
- JSON file (local/dev)
25-
- [Vercel KV](https://vercel.com/docs/storage/vercel-kv) (prod)
19+
**Client-side Libraries**:
20+
- [js-yaml](https://github.com/nodeca/js-yaml) — parse front-matter in notes
21+
- [DOMPurify](https://github.com/cure53/DOMPurify) — sanitize rendered HTML
22+
- [MathJax](https://www.mathjax.org/) — render LaTeX/math expressions
23+
- [Marked.js](https://github.com/markedjs/marked) — Markdown -> HTML parsing
24+
25+
- **Server-side Libraries** (Vercel Serverless Functions):
26+
- [node-fetch](https://github.com/node-fetch/node-fetch) — HTTP client
27+
- [sanitize-html](https://github.com/apostrophecms/sanitize-html) — clean user input
28+
- [@upstash/redis](https://github.com/upstash/upstash-redis) — KV caching
29+
- [pg](https://github.com/brianc/node-postgres) — Neon Serverless Postgres driver
30+
- **Backend**: Node.js (serverless via Vercel)
31+
- Comments: cached in Upstash Redis + persisted in Neon Postgres
32+
33+
## Deployment
34+
35+
This site is deployed on [Vercel](https://vercel.com/) with automatic GitHub-triggered builds.
2636

2737
## Contact
2838

api/comments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default async function handler(req, res) {
4141
timestamp: r.created_at,
4242
}));
4343

44-
await kv.set(cacheKey, comments, { ex: 60 * 5 });
44+
await kv.set(cacheKey, comments, { ex: 60 * 15 });
4545
return res.status(200).json(comments);
4646
}
4747

@@ -69,7 +69,7 @@ export default async function handler(req, res) {
6969
const cacheKey = `comments:${slug}`;
7070
let cached = (await kv.get(cacheKey)) || [];
7171
cached.push(entry);
72-
await kv.set(cacheKey, cached, { ex: 60 * 5 });
72+
await kv.set(cacheKey, cached, { ex: 60 * 15 });
7373

7474
return res.status(201).json(entry);
7575
}

posts/js/comments.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@ document.addEventListener("DOMContentLoaded", () => {
2727
.then(r => r.ok ? r.json() : [])
2828
.then(arr => {
2929
if (!arr.length) {
30-
commentsList.innerHTML =
31-
"<p class='no-comments'>No comments yet. Be the first!</p>";
30+
const prodUrl = `https://robinc.vercel.app${window.location.pathname}${window.location.search}`;
31+
commentsList.innerHTML = `
32+
<p class="no-comments">
33+
No comments yet. Be the first!
34+
Or <a href="${prodUrl}" target="_blank" rel="noopener">
35+
view this post on robinc.vercel.app
36+
</a> if there are any comments there.
37+
</p>`;
3238
} else {
3339
arr.forEach(add);
3440
}

0 commit comments

Comments
 (0)