Skip to content

Commit 3cd40d8

Browse files
committed
Add writing summary
1 parent 2dfea1f commit 3cd40d8

6 files changed

Lines changed: 29 additions & 11 deletions

File tree

‎src/main.rs‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct PostSummary {
1515
slug: String,
1616
title: String,
1717
date_published: String,
18+
summary: String,
1819
}
1920

2021
fn main() -> Result<()> {
@@ -347,9 +348,9 @@ fn render_writings_index(posts: &[PostSummary]) -> String {
347348
let full_date = full_writing_date(&post.date_published);
348349

349350
list_html.push_str(&format!(
350-
r#" <li><a href="./{}.html">{}</a><time class="writing-date" datetime="{}" aria-label="{}" title="{}">{}</time></li>
351+
r#" <li><div class="writing-heading"><a href="./{}.html">{}</a><time class="writing-date" datetime="{}" aria-label="{}" title="{}">{}</time></div><p class="writing-summary">{}</p></li>
351352
"#,
352-
post.slug, post.title, post.date_published, full_date, full_date, display_date
353+
post.slug, post.title, post.date_published, full_date, full_date, display_date, post.summary
353354
));
354355
}
355356

@@ -377,6 +378,10 @@ fn build_writing(path: &std::path::Path) -> Result<PostSummary> {
377378
.context("writing missing slug identifier")?
378379
.to_string();
379380

381+
let summary = writing_meta_value(meta_line, "summary")
382+
.context("writing missing summary")?
383+
.to_string();
384+
380385
let date_published = writing_meta_value(meta_line, "datePublished")
381386
.context("writing missing datePublished identifier")?
382387
.to_string();
@@ -408,6 +413,7 @@ fn build_writing(path: &std::path::Path) -> Result<PostSummary> {
408413
slug,
409414
title,
410415
date_published,
416+
summary,
411417
})
412418
}
413419

@@ -660,16 +666,19 @@ mod tests {
660666
slug: "older".to_string(),
661667
title: "Older".to_string(),
662668
date_published: "2025-01-01".to_string(),
669+
summary: "A summary".to_string(),
663670
},
664671
PostSummary {
665672
slug: "newer-b".to_string(),
666673
title: "B".to_string(),
667674
date_published: "2026-01-01".to_string(),
675+
summary: "A summary".to_string(),
668676
},
669677
PostSummary {
670678
slug: "newer-a".to_string(),
671679
title: "A".to_string(),
672680
date_published: "2026-01-01".to_string(),
681+
summary: "A summary".to_string(),
673682
},
674683
];
675684

@@ -708,6 +717,7 @@ mod tests {
708717
slug: "example".to_string(),
709718
title: "Example".to_string(),
710719
date_published: "2026-06-12".to_string(),
720+
summary: "A summary".to_string(),
711721
}]);
712722

713723
assert!(

‎static/style.css‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,25 @@ article section > p:first-of-type {
314314
text-align: start;
315315
}
316316

317-
.writing-list li {
317+
.writing-heading {
318318
display: flex;
319319
align-items: baseline;
320-
flex-wrap: wrap;
321320
justify-content: space-between;
322-
column-gap: 1rem;
323-
row-gap: 0.125rem;
321+
gap: 1rem;
322+
}
323+
324+
.writing-list li + li {
325+
margin-block-start: var(--space-section-gap);
326+
}
327+
328+
.writing-summary {
329+
margin-block: 0;
330+
opacity: var(--alpha-cite);
331+
font-size: var(--font-size-cite);
324332
}
325333

326334
.writing-date {
327-
color: rgb(var(--tree-ink-rgb) / var(--alpha-muted));
335+
opacity: var(--alpha-muted);
328336
font-size: var(--font-size-cite);
329337
white-space: nowrap;
330338
margin-left: auto;

‎writings/2016-after-election-thanksgiving.dj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{slug="2016-after-election-thanksgiving" inLanguage="en" datePublished="2016-11-24"}
1+
{slug="2016-after-election-thanksgiving" inLanguage="en" datePublished="2016-11-24" summary="A note to Facebook friends and family"}
22
# 2016 After Election Thanksgiving
33

44
Originally posted on [Facebook](https://www.facebook.com/xizhang11/posts/pfbid02Si8PxEtuVcdGEn9N57iGudBE2ekpxGCmhWQKMFgDTmnoi4HEsrLndduiw5zBhu9Bl).

‎writings/michelle.dj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{slug="michelle" inLanguage="en" datePublished="2025-07-27"}
1+
{slug="michelle" inLanguage="en" datePublished="2025-07-27" summary="On layoffs"}
22
# Michelle
33

44
It was Wednesday, September 11th 2019, at least a year before most of my tech friends had experienced a full hype cycle in its depth, I walked in to the glass-windowed conference room Joshua Tree (named after the California park) to join an impromptu meeting with a coworker and our manager when I see two manila folders on the table in front of her that felt out of place at a tech company. Her voice stalls. She forces out terminal news. Her face, and her tone began to betray her composure, and I came to realize that this was harder on her than it was on me. She was dishonest yesterday on our walk−she most definitely did not have a good weekend. I, I want to embrace her.

‎writings/on-changes.dj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{slug="on-changes" inLanguage="en" datePublished="2023-10-19"}
1+
{slug="on-changes" inLanguage="en" datePublished="2023-10-19" summary="On early career changes pre-AI"}
22
# On Changes
33

44
> So, what are you going to do with that [degree in anthropology]?

‎writings/on-values.dj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{slug="on-values" inLanguage="en" datePublished="2026-05-11"}
1+
{slug="on-values" inLanguage="en" datePublished="2026-05-11" summary="How I think about values"}
22
# On Values
33

44
I find intrinsic motivation more effective than extrinsic ones, and value health and growth.

0 commit comments

Comments
 (0)