# Homepage Feature

**URL:** https://meta.discourse.org/t/homepage-feature/144264
**Category:** Theme component
**Tags:** official, homepage-feature
**Created:** [March 13, 2020, 9:16pm UTC](https://meta.discourse.org/t/homepage-feature/144264 "2020-03-13T21:16:58Z")
**Posts on this page:** 1
**Showing post:** 156

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [July 3, 2026, 4:37pm UTC](https://meta.discourse.org/t/homepage-feature/144264/156 "2026-07-03T16:37:22Z")

</div>

> [@bartv](#):
>
> Understood. Will the unneeded thumbnails be automatically removed later?

I don’t think so, because the source images are still in use and these are optimized versions. No real harm other than eating up some storage.

You could clean those up from the rails console, this covers the sizes that were included by default for the setting, and won’t remove images that were generated from a modifier elsewhere.

```ruby
# 1. See what actually exists vs. what's still legitimately registered
still_needed = Topic.thumbnail_sizes +
  ThemeModifierHelper.new(theme_ids: Theme.pluck(:id)).topic_thumbnail_sizes

TopicThumbnail.group(:max_width, :max_height).count

# 2. Remove the unwanted sizes (files + records)
[[300, 300], [600, 600], [900, 900]].each do |w, h|
  next if still_needed.include?([w, h]) # don't touch sizes something else still uses

  TopicThumbnail
    .where(max_width: w, max_height: h)
    .find_each { |tt| tt.optimized_image&.destroy! }

  # attempt-records with no optimized image don't cascade
  TopicThumbnail.where(max_width: w, max_height: h).delete_all
end

```

> [@bartv](#):
>
> And it looks like my theme already has a bunch of different image formats that might work fine - like the 400x400 or 500x500. How about making those selectable?

oh yes, good idea — I can check to see what thumbnails exist already and if there are any, use the best size. If only the originals are available, that will always work as fallback.

Doing this here:

> <https://github.com/discourse/discourse-homepage-feature-component/pull/99>
>
> Previously I had tried adding a theme modifier to generate thumbnail images for …use on smaller screens, but this was undesirable because it would create new thumbnails for every topic on the site (and this theme component only uses a small number of topics).
> 
> Instead of doing that, what we can do here is check if there are any existing thumbnails, and load those into srcset if available. This can result in less bandwidth needed for sites with existing thumbnails, and won't cause any issues if thumbnails aren't present — the original image will still be used.

---

_[View the full topic](https://meta.discourse.org/t/homepage-feature/144264)._
