feat: update latest weather art display

- Change latest weather art limit from 6 to 20
- Shuffle the collection and display the last 10 items
- Update the section title to reflect the shuffling

This commit enhances the visibility of the latest weather art by
increasing the limit of displayed items. It randomizes the selection
of the latest art pieces for a more dynamic user experience, while the
UI title is updated to clarify this feature. This change improves user
engagement with the content.
This commit is contained in:
songtianlun 2025-02-02 00:21:51 +08:00
parent f2951e2741
commit 536b97a7da
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
class HomeController < ApplicationController
def index
@latest_arts = WeatherArt.includes(:city).order(created_at: :desc).limit(6)
@latest_arts = WeatherArt.includes(:city).order(created_at: :desc).limit(20).shuffle.last(10)
@featured_arts = WeatherArt.includes(:city).order(created_at: :desc).limit(5)
set_meta_tags(
title: "AI-Generated Weather Art",

View File

@ -25,7 +25,7 @@
<!-- 最新天气艺术 -->
<section class="container mx-auto px-4 py-16 space-y-12">
<h2 class="text-3xl font-display font-bold text-center">Latest Weather Art</h2>
<h2 class="text-3xl font-display font-bold text-center">Shuffle Latest Weather Art</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<% @latest_arts.each do |art| %>