Adding dynamic features to an aggressively cached website

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Shows developers how to add personalization and dynamic UI to fully CDN-cached sites using client-side localStorage tricks, plus evidence of building features entirely via Claude Code from a phone.

Read this as

Simon Willison, a well-known developer blogger, explains how his Django-based blog adds interactive features despite Cloudflare caching every page for 15 minutes. He hides an 'Edit' button that only appears for himself by checking a localStorage flag in the browser, and adds a 'Random' button that jumps to a random post within a topic tag. He built the random-navigation feature entirely using Claude Code while prompting from his iPhone.

Willison's blog runs behind Cloudflare with a 15-minute cache to survive traffic spikes, which normally rules out any dynamic behavior. He solves this client-side: a browser-side localStorage key reveals admin-only edit links, and a random-tag navigation feature works by checking a timestamped localStorage value within a 5-second window. The takeaway is that aggressive caching and personalization can coexist cheaply, and the whole feature was built with Claude Code from an iPhone.

A Django site behind Cloudflare's 15-minute cache uses two localStorage patterns. Edit links: JavaScript checks an 'ADMIN' key on DOMContentLoaded and injects links from data-admin-url attributes; a custom Django admin checkbox toggles it. Random navigation: /random/TAG/ selects a random post across four content types via a SQL CTE (replacing an order-by-random union that didn't scale to thousands of tags), marks it no-cache, 302-redirects, and a header button persists if random_tag's timestamp is under 5 seconds old. Built via Claude Code for web; full transcripts linked.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

Cloudflare Django Claude Code localStorage CTE

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading