Hasty Briefsbeta

Bilingual

Making a Shuffle Button

a day ago
  • The author updated their notes blog shuffle feature to navigate to a dedicated shuffle page with JavaScript logic instead of embedding all note IDs in every page.
  • The old approach injected all note IDs into every HTML file, causing slow builds and cache invalidation on every new post.
  • A no-JavaScript approach using static links was considered but rejected due to its impact on deployment and caching.
  • The new solution uses a single JSON file or a dedicated HTML page to store note IDs, reducing cache issues.
  • The shuffle page includes a 'Shuffling...' indicator with a 300ms delay to provide user feedback, mimicking old CD players.
  • This approach allows direct access to the shuffle feature via a URL route, without requiring GUI interaction.