Skip to content

Commit 91092b5

Browse files
cullbackclaude
andcommitted
Set up Zola blog with Pico CSS and semantic HTML
- Configured Zola with syntax highlighting and markdown features - Added Pico CSS for clean, semantic styling - Created base template with KaTeX math rendering support - Added semantic HTML templates for index and blog posts - Created taxonomy templates for tags - Added hello world blog post demonstrating: - Markdown tables with alignment - LaTeX math rendering (inline and display) - Code syntax highlighting for multiple languages - Responsive design with Pico CSS 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 20e887e commit 91092b5

8 files changed

Lines changed: 447 additions & 0 deletions

File tree

config.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,21 @@ compile_sass = false
77
# Whether to build a search index to be used later on by a JavaScript library
88
build_search_index = false
99

10+
# Enable tags taxonomy
11+
taxonomies = [
12+
{ name = "tags", feed = true },
13+
]
14+
1015
[markdown]
1116
# Whether to do syntax highlighting
1217
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
1318
highlight_code = true
19+
highlight_theme = "base16-ocean-dark"
20+
21+
# Enable KaTeX for math rendering
22+
render_emoji = true
23+
external_links_target_blank = true
24+
smart_punctuation = true
1425

1526
[extra]
1627
# Put all your custom variables here

content/_index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
+++
2+
title = "Blog Posts"
3+
sort_by = "date"
4+
template = "index.html"
5+
+++

content/hello-world.md

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
+++
2+
title = "Hello World: A Markdown Feature Showcase"
3+
date = 2025-08-03
4+
description = "A demonstration of Markdown features including tables, LaTeX math, and syntax highlighting"
5+
6+
[taxonomies]
7+
tags = ["markdown", "demo", "hello-world"]
8+
+++
9+
10+
Welcome to my new blog! This post demonstrates various Markdown features supported by Zola, including tables, LaTeX math rendering, and code syntax highlighting.
11+
12+
<!-- more -->
13+
14+
## Markdown Tables
15+
16+
Here's an example of a Markdown table showing different programming languages and their features:
17+
18+
| Language | Type System | Paradigm | Year Created |
19+
|----------|-------------|----------|--------------|
20+
| Python | Dynamic | Multi-paradigm | 1991 |
21+
| Rust | Static | Systems | 2010 |
22+
| JavaScript | Dynamic | Multi-paradigm | 1995 |
23+
| Go | Static | Concurrent | 2009 |
24+
| Haskell | Static | Functional | 1990 |
25+
26+
Tables can also be aligned:
27+
28+
| Left Aligned | Center Aligned | Right Aligned |
29+
|:-------------|:--------------:|--------------:|
30+
| Cell 1 | Cell 2 | Cell 3 |
31+
| Lorem | Ipsum | Dolor |
32+
| Sit | Amet | Consectetur |
33+
34+
## LaTeX Math Rendering
35+
36+
Zola supports both inline and display math using KaTeX. Here are some examples:
37+
38+
### Inline Math
39+
40+
The quadratic formula is $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$, which gives us the roots of a quadratic equation.
41+
42+
Euler's identity is often cited as the most beautiful equation in mathematics: $e^{i\pi} + 1 = 0$.
43+
44+
### Display Math
45+
46+
The Gaussian integral:
47+
48+
$$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$
49+
50+
Maxwell's equations in differential form:
51+
52+
$$\begin{align}
53+
\nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\
54+
\nabla \cdot \mathbf{B} &= 0 \\
55+
\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
56+
\nabla \times \mathbf{B} &= \mu_0 \mathbf{J} + \mu_0 \epsilon_0 \frac{\partial \mathbf{E}}{\partial t}
57+
\end{align}$$
58+
59+
The definition of the Fourier transform:
60+
61+
$$\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) e^{-2\pi i x \xi} dx$$
62+
63+
## Code Syntax Highlighting
64+
65+
Zola provides excellent syntax highlighting for various programming languages. Here are some examples:
66+
67+
### Python
68+
69+
```python
70+
def fibonacci(n):
71+
"""Generate Fibonacci sequence up to n terms."""
72+
if n <= 0:
73+
return []
74+
elif n == 1:
75+
return [0]
76+
77+
sequence = [0, 1]
78+
for i in range(2, n):
79+
next_num = sequence[i-1] + sequence[i-2]
80+
sequence.append(next_num)
81+
82+
return sequence
83+
84+
# Example usage
85+
fib_numbers = fibonacci(10)
86+
print(f"First 10 Fibonacci numbers: {fib_numbers}")
87+
```
88+
89+
### Rust
90+
91+
```rust
92+
use std::collections::HashMap;
93+
94+
#[derive(Debug)]
95+
struct User {
96+
id: u32,
97+
name: String,
98+
email: String,
99+
}
100+
101+
impl User {
102+
fn new(id: u32, name: String, email: String) -> Self {
103+
User { id, name, email }
104+
}
105+
106+
fn display(&self) {
107+
println!("User {}: {} ({})", self.id, self.name, self.email);
108+
}
109+
}
110+
111+
fn main() {
112+
let mut users: HashMap<u32, User> = HashMap::new();
113+
114+
users.insert(1, User::new(1, "Alice".to_string(), "alice@example.com".to_string()));
115+
users.insert(2, User::new(2, "Bob".to_string(), "bob@example.com".to_string()));
116+
117+
for (_, user) in &users {
118+
user.display();
119+
}
120+
}
121+
```
122+
123+
### JavaScript
124+
125+
```javascript
126+
// Modern ES6+ JavaScript example
127+
class TodoList {
128+
constructor() {
129+
this.todos = [];
130+
this.nextId = 1;
131+
}
132+
133+
addTodo(text) {
134+
const todo = {
135+
id: this.nextId++,
136+
text,
137+
completed: false,
138+
createdAt: new Date()
139+
};
140+
this.todos.push(todo);
141+
return todo;
142+
}
143+
144+
toggleTodo(id) {
145+
const todo = this.todos.find(t => t.id === id);
146+
if (todo) {
147+
todo.completed = !todo.completed;
148+
}
149+
}
150+
151+
getActiveTodos() {
152+
return this.todos.filter(todo => !todo.completed);
153+
}
154+
}
155+
156+
// Usage with async/await
157+
async function fetchAndAddTodos() {
158+
const todoList = new TodoList();
159+
160+
try {
161+
const response = await fetch('/api/todos');
162+
const todos = await response.json();
163+
164+
todos.forEach(todo => {
165+
todoList.addTodo(todo.text);
166+
});
167+
168+
console.log(`Added ${todos.length} todos`);
169+
} catch (error) {
170+
console.error('Failed to fetch todos:', error);
171+
}
172+
}
173+
```
174+
175+
### HTML/CSS
176+
177+
```html
178+
<!DOCTYPE html>
179+
<html lang="en">
180+
<head>
181+
<meta charset="UTF-8">
182+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
183+
<title>Semantic HTML Example</title>
184+
<style>
185+
:root {
186+
--primary-color: #007bff;
187+
--text-color: #333;
188+
--bg-color: #f8f9fa;
189+
}
190+
191+
body {
192+
font-family: system-ui, -apple-system, sans-serif;
193+
color: var(--text-color);
194+
background-color: var(--bg-color);
195+
line-height: 1.6;
196+
}
197+
198+
.card {
199+
background: white;
200+
border-radius: 8px;
201+
padding: 1.5rem;
202+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
203+
transition: transform 0.2s ease;
204+
}
205+
206+
.card:hover {
207+
transform: translateY(-2px);
208+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
209+
}
210+
</style>
211+
</head>
212+
<body>
213+
<main>
214+
<article class="card">
215+
<h1>Welcome to Semantic HTML</h1>
216+
<p>Using proper HTML5 semantic elements improves accessibility and SEO.</p>
217+
</article>
218+
</main>
219+
</body>
220+
</html>
221+
```
222+
223+
## Conclusion
224+
225+
This blog is now set up with:
226+
227+
- ✅ Zola static site generator
228+
- ✅ Pico CSS for clean, semantic styling
229+
- ✅ KaTeX for beautiful math rendering
230+
- ✅ Syntax highlighting for code blocks
231+
- ✅ Responsive design out of the box
232+
233+
Feel free to explore these features and start writing your own posts!

templates/base.html

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>{% block title %}{{ config.title }}{% endblock title %}</title>
7+
8+
<!-- Pico CSS -->
9+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
10+
11+
<!-- KaTeX for math rendering -->
12+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css" integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV" crossorigin="anonymous">
13+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js" integrity="sha384-XjKyOOlGwcjNTAIQHIpgOno0Hl1YQqzUOEleOLALmuqehneUG+vnGctmUb0ZY0l8" crossorigin="anonymous"></script>
14+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"></script>
15+
16+
<!-- Custom styles -->
17+
<style>
18+
/* Override Pico CSS defaults for better blog layout */
19+
body > main {
20+
padding-top: 2rem;
21+
}
22+
23+
/* Code highlighting styles */
24+
pre {
25+
overflow-x: auto;
26+
padding: 1rem;
27+
background-color: var(--code-background-color);
28+
border-radius: var(--border-radius);
29+
}
30+
31+
/* Math display styles */
32+
.katex-display {
33+
overflow-x: auto;
34+
overflow-y: hidden;
35+
padding: 1rem 0;
36+
}
37+
38+
/* Blog post meta */
39+
.post-meta {
40+
color: var(--muted-color);
41+
font-size: 0.875rem;
42+
margin-bottom: 2rem;
43+
}
44+
45+
/* Semantic article styling */
46+
article header {
47+
margin-bottom: 2rem;
48+
}
49+
50+
article footer {
51+
margin-top: 3rem;
52+
padding-top: 2rem;
53+
border-top: 1px solid var(--muted-border-color);
54+
}
55+
</style>
56+
57+
{% block extra_head %}{% endblock extra_head %}
58+
</head>
59+
<body>
60+
<main class="container">
61+
<header>
62+
<nav>
63+
<ul>
64+
<li><strong><a href="{{ config.base_url }}">My Blog</a></strong></li>
65+
</ul>
66+
<ul>
67+
<li><a href="{{ config.base_url }}">Home</a></li>
68+
<li><a href="{{ config.base_url }}/about">About</a></li>
69+
</ul>
70+
</nav>
71+
</header>
72+
73+
{% block content %}{% endblock content %}
74+
75+
<footer>
76+
<p>&copy; {{ now() | date(format="%Y") }} My Blog. Built with <a href="https://www.getzola.org/">Zola</a> and <a href="https://picocss.com/">Pico CSS</a>.</p>
77+
</footer>
78+
</main>
79+
80+
<!-- KaTeX auto-render -->
81+
<script>
82+
document.addEventListener("DOMContentLoaded", function() {
83+
renderMathInElement(document.body, {
84+
delimiters: [
85+
{left: '$$', right: '$$', display: true},
86+
{left: '$', right: '$', display: false},
87+
{left: '\\(', right: '\\)', display: false},
88+
{left: '\\[', right: '\\]', display: true}
89+
],
90+
throwOnError: false
91+
});
92+
});
93+
</script>
94+
</body>
95+
</html>

templates/index.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{% extends "base.html" %}
2+
3+
{% block content %}
4+
<section>
5+
<hgroup>
6+
<h1>Welcome to My Blog</h1>
7+
<p>Thoughts on technology, programming, and more</p>
8+
</hgroup>
9+
</section>
10+
11+
<section>
12+
<h2>Recent Posts</h2>
13+
{% set section = get_section(path="_index.md") %}
14+
{% for page in section.pages %}
15+
<article>
16+
<header>
17+
<h3><a href="{{ page.permalink }}">{{ page.title }}</a></h3>
18+
<time datetime="{{ page.date }}">{{ page.date | date(format="%B %d, %Y") }}</time>
19+
</header>
20+
{% if page.summary %}
21+
<p>{{ page.summary }}</p>
22+
{% endif %}
23+
<footer>
24+
<a href="{{ page.permalink }}" role="button">Read more →</a>
25+
</footer>
26+
</article>
27+
{% endfor %}
28+
</section>
29+
{% endblock content %}

0 commit comments

Comments
 (0)