diff --git a/TIPS.md b/TIPS.md index b7aba50..1dc77ad 100644 --- a/TIPS.md +++ b/TIPS.md @@ -34,3 +34,4 @@ Going forward, new tips are pushed automatically by the `mc_survival_tips.py` cr - [Tip #39](tips/2026-07-20-039-performance-native-lazy-loading-for-item-icons.md) (2026-07-20) — **performance**: Native lazy-loading for item icons - [Tip #40](tips/2026-07-21-040-i18n-add-english-ui-translation.md) (2026-07-21) — **i18n**: Add English UI translation - [Tip #41](tips/2026-07-22-041-social-dynamic-og-image-share-previews.md) (2026-07-22) — **social**: Dynamic OG-Image share previews +- [Tip #42](tips/2026-07-23-042-data-most-viewed-recipes-widget.md) (2026-07-23) — **data**: Most-Viewed Recipes widget diff --git a/tips/2026-07-23-042-data-most-viewed-recipes-widget.md b/tips/2026-07-23-042-data-most-viewed-recipes-widget.md new file mode 100644 index 0000000..f59a9ad --- /dev/null +++ b/tips/2026-07-23-042-data-most-viewed-recipes-widget.md @@ -0,0 +1,22 @@ +--- +tip_number: 42 +date: 2026-07-23 +category: data +status: 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 + +1. Track views in a RecipeView { recipeId, userId?, createdAt } table (write-only, no read overhead). +2. Aggregate query: top 10 by count, last 30 days, exclude bots (no User-agent filter — keep simple). +3. Cache the result for 1h with TanStack Query — re-aggregating on every page load is wasteful.