These are the source files for Evan Chen's personal blog, https://blog.evanchen.cc.
Pull requests to fix typos, repair broken site functionality, and so on are greatly appreciated (indeed this is a motivation for a public GitHub). It might also be helpful if you want to see how the site was built.
After installing uv, do
uv syncto install dependenciesuv run prek installto install pre-commit hooks
In theory, you can compile the content with the following:
uv run pelican contentto build development site tooutput/uv run pelican content -s publishconf.pyto build the published version tooutput/(absolute URL's)uv run pelican --listento launch a development server
However, in practice when developing you probably don't need to compile all 100+ posts for testing, or for previewing a single post (particularly since KaTeX rendering is really slow). Instead, the following utility scripts are provided:
scripts/recent.sh [N]sets up a dev server where only posts in the last N days are rendered. By default, N = 365, i.e., this renders only the last year of posts.scripts/watch-one.sh <slug>sets up a dev server that only renders a single post specified by the slug.
When I am drafting brand-new posts,
I do so on a separate branch dev rather than main.
That way the Git history for main remains clean,
rather than seeing the long revision history of the posts being edited.
(Writing is rewriting, you know?)
I actually use a separate worktree altogether for this workflow. But you can also switch branches manually.
The workflow goes as follows:
-
git merge mainindevto bringdevup to date. -
./scripts/new.pyis used ondevto create a new post. The date is set as December 31, 2099, since I really hope that I can finish the post by then. -
Slowly work on the post (often over way-too-many months).
-
When the post is ready to publish, run
./scripts/stage.sh <slug> [YYYY-MM-DD]ondev. This changes the status fromdrafttopublishedand updates the date. -
Once the post is ready to bring into main, run
./scripts/finalize.sh <slug>onmainto copy the finalized post in. This creates a commitfeat(slug): publish on main. -
Again,
git merge mainindevto bringdevup to date with the published post.
To preserve my sanity,
commits from dev NEVER appear directly on main.
In other words, besides the finalize.sh script that simply copies
the completed drafts off the dev branch,
the main branch never receives anything from the dev branch.
To show posts on dev not in main, use ./scripts/queue.sh (from any branch).
The posts are labeled as either draft until stage.sh,
at which point they are staged until finalize.sh is run.