Skip to content

Commit 7a92bb4

Browse files
committed
theme update
1 parent 0758acb commit 7a92bb4

37 files changed

Lines changed: 1103 additions & 0 deletions

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,37 @@ bundle exec jekyll serve
3838

3939
Then open: `http://127.0.0.1:4000/wordpress/`
4040

41+
## Importing new posts from WordPress XML
42+
43+
Use the built-in migration script. You do not need to manually convert XML to Markdown.
44+
45+
```bash
46+
cd my-site
47+
bundle exec ruby scripts/wordpress_to_jekyll.rb \
48+
--xml import/leo.WordPress.2026-04-23.xml \
49+
--posts-dir _posts
50+
```
51+
52+
Notes:
53+
54+
- Existing post filename collisions are skipped (safe default).
55+
- This means re-running the script will add new posts and keep existing files.
56+
- If you edited a post on WordPress and want to refresh that same post file, remove that specific `_posts/YYYY-MM-DD-slug.md` and run the script again.
57+
58+
## Regenerating category pages
59+
60+
After adding or changing posts/categories, regenerate category pages and category index:
61+
62+
```bash
63+
cd my-site
64+
bundle exec ruby scripts/generate_category_pages.rb
65+
```
66+
67+
This updates:
68+
69+
- `my-site/category/*.markdown` (one page per category)
70+
- `my-site/categories.markdown` (all categories index)
71+
4172
## Deployment
4273

4374
This repo deploys with GitHub Actions on push to `main`.

my-site/_layouts/category.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
layout: default
3+
---
4+
5+
<div class="category-page">
6+
<header class="category-header">
7+
<p class="kicker">Category</p>
8+
<h1>{{ page.category_name }}</h1>
9+
<p>{{ page.category_count }} posts</p>
10+
</header>
11+
12+
<ul class="category-posts">
13+
{% assign cat_posts = site.posts | where_exp: "post", "post.categories contains page.category_name" %}
14+
{% for post in cat_posts %}
15+
<li>
16+
<span class="meta">{{ post.date | date: "%Y-%m-%d" }}</span>
17+
<h2><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h2>
18+
<p>{{ post.excerpt | strip_html | normalize_whitespace | truncate: 170 }}</p>
19+
</li>
20+
{% endfor %}
21+
</ul>
22+
</div>

my-site/_layouts/home.html

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
---
2+
layout: default
3+
---
4+
5+
<div class="mag-shell">
6+
<header class="mag-masthead">
7+
<p class="edition">Weekend Edition · {{ "now" | date: "%Y-%m-%d" }}</p>
8+
<h1>{{ site.title }}</h1>
9+
<p class="deck">{{ site.description }}</p>
10+
<nav class="mast-nav" aria-label="Homepage sections">
11+
<a href="#lead">Top Story</a>
12+
<a href="#headlines">Headlines</a>
13+
<a href="#latest">Latest</a>
14+
<a href="{{ '/archive/' | relative_url }}">Archive</a>
15+
<a href="{{ '/about/' | relative_url }}">About</a>
16+
</nav>
17+
</header>
18+
19+
<div class="mag-frontpage">
20+
<main class="mag-main">
21+
{% assign featured = site.posts.first %}
22+
23+
{% if featured %}
24+
{% assign featured_parts = featured.content | split: 'src="' %}
25+
{% if featured_parts.size > 1 %}
26+
{% assign featured_image = featured_parts[1] | split: '"' | first %}
27+
{% else %}
28+
{% assign featured_image = nil %}
29+
{% endif %}
30+
31+
<section id="lead" class="lead-package">
32+
<article class="lead-story">
33+
{% if featured_image %}
34+
<a class="lead-media" href="{{ featured.url | relative_url }}" aria-label="{{ featured.title | escape }}">
35+
<img src="{{ featured_image }}" alt="{{ featured.title | escape }}" loading="eager" />
36+
</a>
37+
{% endif %}
38+
<div class="lead-copy">
39+
<p class="kicker">Cover Story</p>
40+
<h2><a href="{{ featured.url | relative_url }}">{{ featured.title }}</a></h2>
41+
<p class="meta">{{ featured.date | date: "%Y-%m-%d" }}{% if featured.author %} · {{ featured.author }}{% endif %}</p>
42+
<p>{{ featured.excerpt | strip_html | normalize_whitespace | truncate: 220 }}</p>
43+
<a class="read-more" href="{{ featured.url | relative_url }}">Read Story</a>
44+
</div>
45+
</article>
46+
47+
<div class="lead-side">
48+
<h3>Editor Picks</h3>
49+
{% for post in site.posts offset:1 limit:3 %}
50+
{% assign side_parts = post.content | split: 'src="' %}
51+
{% if side_parts.size > 1 %}
52+
{% assign side_image = side_parts[1] | split: '"' | first %}
53+
{% else %}
54+
{% assign side_image = nil %}
55+
{% endif %}
56+
57+
<article class="mini-story">
58+
{% if side_image %}
59+
<a class="mini-media" href="{{ post.url | relative_url }}" aria-label="{{ post.title | escape }}">
60+
<img src="{{ side_image }}" alt="{{ post.title | escape }}" loading="lazy" />
61+
</a>
62+
{% endif %}
63+
<div>
64+
<p class="meta">{{ post.date | date: "%Y-%m-%d" }}</p>
65+
<h4><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h4>
66+
</div>
67+
</article>
68+
{% endfor %}
69+
</div>
70+
</section>
71+
{% endif %}
72+
73+
<section id="headlines" class="headline-ribbon">
74+
<h3>Headlines</h3>
75+
<ul>
76+
{% for post in site.posts offset:4 limit:6 %}
77+
<li>
78+
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
79+
<span>{{ post.date | date: "%Y-%m-%d" }}</span>
80+
</li>
81+
{% endfor %}
82+
</ul>
83+
</section>
84+
85+
<section id="latest" class="latest-grid">
86+
<div class="section-head">
87+
<h3>Latest Dispatches</h3>
88+
<a href="{{ '/archive/' | relative_url }}" class="section-link">View all</a>
89+
</div>
90+
<div class="post-cards">
91+
{% for post in site.posts offset:10 limit:9 %}
92+
{% assign card_parts = post.content | split: 'src="' %}
93+
{% if card_parts.size > 1 %}
94+
{% assign card_image = card_parts[1] | split: '"' | first %}
95+
{% else %}
96+
{% assign card_image = nil %}
97+
{% endif %}
98+
99+
<article class="post-card">
100+
{% if card_image %}
101+
<a class="card-media" href="{{ post.url | relative_url }}" aria-label="{{ post.title | escape }}">
102+
<img src="{{ card_image }}" alt="{{ post.title | escape }}" loading="lazy" />
103+
</a>
104+
{% endif %}
105+
<div class="card-body">
106+
<p class="meta">{{ post.date | date: "%Y-%m-%d" }}</p>
107+
<h4><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h4>
108+
<p>{{ post.excerpt | strip_html | normalize_whitespace | truncate: 120 }}</p>
109+
</div>
110+
</article>
111+
{% endfor %}
112+
</div>
113+
</section>
114+
</main>
115+
116+
<aside class="mag-sidebar">
117+
<section class="sidebar-card">
118+
<h3>From the Desk</h3>
119+
<p>Books, films, and life notes from Leo, archived and continuously updated.</p>
120+
</section>
121+
122+
<section class="sidebar-card">
123+
<h3>Recent</h3>
124+
<ul class="compact-list">
125+
{% for post in site.posts limit:7 %}
126+
<li>
127+
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
128+
<span>{{ post.date | date: "%m-%d" }}</span>
129+
</li>
130+
{% endfor %}
131+
</ul>
132+
</section>
133+
134+
<section class="sidebar-card">
135+
<h3>Topics</h3>
136+
<ul class="topic-cloud">
137+
{% for category in site.categories limit:12 %}
138+
{% assign category_page = site.pages | where: "category_name", category[0] | first %}
139+
<li>
140+
{% if category_page %}
141+
<a class="topic-link" href="{{ category_page.url | relative_url }}">
142+
<span class="topic-name">{{ category[0] }}</span>
143+
<span class="topic-count">{{ category[1].size }}</span>
144+
</a>
145+
{% else %}
146+
<span class="topic-name">{{ category[0] }}</span>
147+
<span class="topic-count">{{ category[1].size }}</span>
148+
{% endif %}
149+
</li>
150+
{% endfor %}
151+
</ul>
152+
<p class="topic-all"><a href="{{ '/categories/' | relative_url }}">Browse all categories</a></p>
153+
</section>
154+
155+
<section class="sidebar-card">
156+
<h3>By Year</h3>
157+
<ul class="compact-list years">
158+
{% assign posts_by_year = site.posts | group_by_exp: "post", "post.date | date: '%Y'" %}
159+
{% for year in posts_by_year limit:10 %}
160+
<li>
161+
<span>{{ year.name }}</span>
162+
<span>{{ year.items | size }} posts</span>
163+
</li>
164+
{% endfor %}
165+
</ul>
166+
</section>
167+
</aside>
168+
</div>
169+
</div>

my-site/archive.markdown

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
layout: page
3+
title: Archive
4+
permalink: /archive/
5+
---
6+
7+
<ul class="post-list">
8+
{% for post in site.posts %}
9+
<li>
10+
<span class="post-meta">{{ post.date | date: "%Y-%m-%d" }}</span>
11+
<h3>
12+
<a class="post-link" href="{{ post.url | relative_url }}">{{ post.title }}</a>
13+
</h3>
14+
</li>
15+
{% endfor %}
16+
</ul>

0 commit comments

Comments
 (0)