Skip to content

Commit 536c305

Browse files
committed
Styling consistency
1 parent ab19681 commit 536c305

8 files changed

Lines changed: 99 additions & 16 deletions

File tree

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ This repository contains the source code for my personal website. The site serve
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+
- **Pagination & Filtering**: Browse posts by tag or search with pagination.
1314

1415
## Tech Stack
1516

16-
- **Frontend**: HTML, CSS, JavaScript
17+
- **Frontend**: HTML, CSS, JavaScript (Vanilla)
1718
- **Libraries**:
18-
- [Marked.js](https://github.com/markedjs/marked) for Markdown parsing
19-
- [MathJax](https://www.mathjax.org/) for rendering math
20-
- **Backend**: Node.js API (serverless) to handle posting and fetching comments
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)
2126

2227
## Contact
2328

about.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,18 @@ <h2>Connect with Me</h2>
4949

5050
<h2>Tech Stack</h2>
5151
<p>
52-
This site is built with vanilla HTML, CSS, and JavaScript.
53-
It uses minimal libraries to stay lightweight, with <code>marked.js</code> for Markdown parsing and
54-
<code>MathJax</code> for rendering math.
52+
This site is built with vanilla HTML, CSS, and JavaScript. It uses minimal dependencies to stay
53+
lightweight, including:
54+
</p>
55+
<ul>
56+
<li><code>marked.js</code> – for client-side Markdown rendering</li>
57+
<li><code>MathJax</code> – for TeX/LaTeX rendering in posts</li>
58+
<li><code>DOMPurify</code> – for safe rendering of user-submitted content</li>
59+
<li><code>Vercel KV</code> (optional) – for serverless comment storage</li>
60+
</ul>
61+
<p>
62+
The comment system gracefully falls back to local JSON storage in development mode. Blog entries now use
63+
a JSON-based front-matter metadata system.
5564
</p>
5665

5766
<a href="index.html" class="back-link">Back to Home</a>

blog.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<button id="next-button">Next</button>
3434
</div>
3535

36+
<a href="index.html" class="back-link">Back to Home</a>
3637
<footer id="footer-placeholder"></footer>
3738
<script type="module" src="js/header-footer.js"></script>
3839
<script src="js/blog.js"></script>

css/blog.css

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,76 @@
7272
background-color: #666;
7373
}
7474

75+
#tag-buttons {
76+
display: flex;
77+
flex-wrap: wrap;
78+
gap: 0.5rem;
79+
margin-bottom: 2rem;
80+
}
81+
82+
.post-entry {
83+
display: flex;
84+
align-items: flex-start;
85+
justify-content: space-between;
86+
margin-bottom: 2rem;
87+
/* space between entries */
88+
padding-bottom: 1rem;
89+
border-bottom: 1px solid #ddd;
90+
}
91+
92+
.dark-mode .post-entry {
93+
border-color: #444;
94+
}
95+
96+
.post-title {
97+
flex: 1;
98+
font-size: 1.8rem;
99+
/* larger title */
100+
margin-right: 1rem;
101+
color: var(--link-color, #0055aa);
102+
text-decoration: none;
103+
}
104+
105+
.post-title:hover {
106+
text-decoration: underline;
107+
}
108+
109+
.post-meta-inline {
110+
text-align: right;
111+
font-size: 0.9rem;
112+
color: #555;
113+
margin-bottom: 0.5rem;
114+
}
115+
116+
.dark-mode .post-meta-inline {
117+
color: #aaa;
118+
}
119+
120+
.post-entry .post-tag {
121+
display: inline-block;
122+
background-color: #eee;
123+
color: #555;
124+
font-size: 0.85rem;
125+
border: none;
126+
padding: 0.5rem 1rem;
127+
margin: 0.2rem 0.3rem 0.2rem 0;
128+
border-radius: 0.5rem;
129+
transition: background-color 0.2s ease;
130+
}
131+
132+
.post-entry .post-tag:hover {
133+
background-color: #ddd;
134+
}
135+
136+
.dark-mode .post-entry .post-tag {
137+
background-color: #555;
138+
color: #eee;
139+
}
140+
141+
.dark-mode .post-entry .post-tag:hover {
142+
background-color: #666;
143+
}
144+
75145
/* Search bar */
76146
#search-box {
77147
width: 100%;

css/post.css

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ article#post-content .post-meta {
8383

8484
/* Dark Mode (Post-specific) */
8585
.dark-mode #comments-section {
86-
background-color: #0055aa;
86+
background-color: #001133;
8787
color: #fff;
8888
}
8989

9090
.dark-mode #comments-list p {
91-
background-color: #0055aa;
91+
background-color: #001133;
9292
}
9393

9494
.dark-mode .comment-author {
@@ -97,7 +97,6 @@ article#post-content .post-meta {
9797

9898
.dark-mode #comment-form button {
9999
background-color: #333;
100-
/* Matches dark-mode theme-toggle */
101100
color: #eee;
102101
}
103102

@@ -108,7 +107,6 @@ article#post-content .post-meta {
108107
.dark-mode #comment-form textarea,
109108
.dark-mode #comment-form input[type="text"] {
110109
background-color: #555;
111-
/* Matches dark-mode input in shared.css */
112110
color: #eee;
113111
}
114112

js/blog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function renderPosts(posts, filterTag = null) {
4545

4646
const meta = document.createElement("div");
4747
meta.className = "post-meta-inline";
48-
meta.textContent = `${post.date}${post.author ? ` by ${post.author}` : ""}`;
48+
meta.textContent = `${post.date}${post.author ? ` - by ${post.author}` : ""}`;
4949

5050
const tagsDiv = document.createElement("div");
5151
(post.tags || []).forEach(tag => {

js/post.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ fetch(`/posts/entries/${slug}.md`)
2525

2626
const h1 = document.createElement("h1"); h1.textContent = meta.title || "Untitled";
2727
const footerDiv = document.createElement("div");
28+
29+
const bodyDiv = document.createElement("div"); bodyDiv.innerHTML = html;
30+
content.appendChild(bodyDiv);
31+
2832
footerDiv.className = "post-location";
2933
const author = meta.author || "Anonymous";
3034
const date = meta.date || "In a fragment of time";
3135
const loc = meta.location ? ` in ${meta.location}` : "Somewhere on Earth";
3236
footerDiv.textContent = `${author}, ${date}${loc}`;
33-
3437
content.append(h1, footerDiv);
35-
const bodyDiv = document.createElement("div"); bodyDiv.innerHTML = html;
36-
content.appendChild(bodyDiv);
3738

3839
/* MathJax render if present */
3940
if (window.MathJax) { window.MathJax.typesetPromise?.([content]); }

projects.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ <h1>Projects</h1>
3535

3636
<footer id="footer-placeholder"></footer>
3737

38-
<script src="js/theme.js"></script>
3938
<script type="module" src="js/header-footer.js"></script>
4039
<script src="js/projects.js"></script>
4140
</body>

0 commit comments

Comments
 (0)