1.2 KiB
tip_number, date, category, status
| tip_number | date | category | status |
|---|---|---|---|
| 42 | 2026-07-23 | data | pending |
Tip #42 — Most-Viewed Recipes widget
Date: 2026-07-23
Category: data
Source: MC-Survival Wiki Daily Tip (cron @ 18:00 MESZ)
Most-Viewed Recipes widget
Track recipe views in a write-only RecipeView { recipeId, userId?, createdAt } table, aggregate the top 10 over the last 30 days, and render them as a widget on the homepage. It solves the 'what is popular' discovery problem: new visitors have no signal about which recipes are most useful, and a 'Most-Viewed' list is the universal way to bootstrap that. The signal is engagement analytics — a top-10 list consistently outperforms a 'featured' or editor-picked list, because the data reflects what the community actually uses. Caching the aggregate for 1 hour via TanStack Query keeps the cost negligible, and writing the view events is a single insert per page load.
Implementation tips
- Track views in a RecipeView { recipeId, userId?, createdAt } table (write-only, no read overhead).
- Aggregate query: top 10 by count, last 30 days, exclude bots (no User-agent filter — keep simple).
- Cache the result for 1h with TanStack Query — re-aggregating on every page load is wasteful.