Topic List Previews



Thank you so much for this plugin! It really made the difference between a boring text only front page into a modern looking rich view with instant visual context.
I do have a request/question: I noticed that it only grabs images from the topic itself as thumbnail. I would like that in case there isn’t an image in the topic, it would grab the first image from the comments. Is that possible?


Anything is possible, but obviously there’s a performance penalty and additional complexity with that request. Also consider that the OP might be the one who wants control over what is displayed.

One workaround for now as admin that I use (and not much overhead if edge case): copy and paste the URL of the uploaded image to the bottom of the OP and rebuild the HTML. This has low impact as you are reusing the image so no additional space is used, its just a presentational change.


I think that if such feature exists, for sure it has to be a category setting. Not everyone will want it. But I think that if the OP wants to control over what is displayed, he can post an image of his liking and naturally get priority.

(MengyuLi) #45

Hi all
I see the examples and I really like this plugin.
I installed it on my mac, in the development environment, but it looks like this:

It looks a little strange. The UI has been changed, but I cannot see previews. Can anyone help me?
I have set topic list thumbnail, topic list excerpt, and topic list action to be ‘latest’.
I have set ’ topic list previews enabled’ to be true.
Where I get this plugin: git clone
Do I miss anything?


You need to run sidekiq as the preview images are generated in an asynchronous job.


bundle exec sidekiq

I believe

In development this is not run as default

(MengyuLi) #47

Hi, thanks for your reply.
Unfortunately, it doesn’t work.

I run ‘bundle exec sidekiq’ and the terminal shows as below:

2018-12-05T02:54:44.335Z 1080 TID-oxry5tx6g INFO: Booting Sidekiq 5.1.3 with redis options {:host=>"localhost", :port=>6379, :namespace=>"sidekiq", :id=>"Sidekiq-server-PID-1080", :url=>nil}

The topic list doesn’t show preview images and excerpt words as we expected.
Do you think I should run production-environment on a server directly? Currently, it’s running under development-environment on my mac.

I run:

bundle exec sidekiq
rails s -p 80


Trying to repro here, will revert

(MengyuLi) #49

Oh, I know what’s wrong… I just forget to change settings…
I thought I have already set it, but actually not…
Just set topic-list-social, and some others, as described above.
I’m so stupid… Thanks Merefield. Thanks for your help !

(MengyuLi) #51

Another issue, all images seem to be square… Any idea for that?
No matter what size of images I uploaded, they are all cropped to square…


Pleasure. Glad you have the original issue sorted. (I was able to reproduce your issue but only when site_settings.yml or database.yml were incorrect.)

To your new issue:

The plugin generates thumbnails of fixed size (that you specify) to reduce bandwidth and improve performance. An unfortunate side effect for some use cases is that original aspect ratio can be lost.

The Tiles mode however can respect the original aspect ratio but only if you switch thumbnailing off in the settings.


(MengyuLi) #53

It works! Do you know to what extent it will affect performance? I have no idea about that. Are you setting this in your website: Topic List Previews - Angus' Sandbox ?


That’s Angus’ site. Can’t comment. :wink:

I use full size images on one of my sites with no issues. Try it. :).

(T. H. Wright) #55

I have a feature request. For the topic list tiles view, would it be possible to add an option that disables automatic scrolling for adding new posts and instead places a centered “view more” (or your text here) button?

The thought came to me as I have a footer on my website which is more or less useless. Perhaps I should ditch the footer instead, but this seemed like a decent proposal for a fix. This would also give the user more control over how their device behaves when interacting with the website.

Also, just overall praise for the plugin. I just discovered the featured posts setting. Marvelous! Absolutely marvelous!


Thank you.

My opinion as contributor (but not owner): I don’t think replacing infinite scroll is the focus of this plugin. It might make sense for that to live in a different plugin.

Perhaps you could leverage an existing attempt at this if such a thing exists. Did you search? I note there’s been a lot of debate about this previously on meta regarding footers and buttons. For example, this post.

Infinite scroll on the TL is a key part of how Discourse works. In fact it was not trivial to get the masonry code to hook into it: a button would have made it much easier!! :smiley:

(MengyuLi) #57

Do you think we can use the code below to solve the performance issue?

document.getElementById("list-area").style.display = "none";
function show(){



Can you explain why that would work? I’m not sure it addresses the core issue?:

The issue is simply that by sending down the images full size (and by full size that’s actually determined by the limit the Discourse engine sets up) you are using more bandwidth and more processing power on the client to then scale them back.

This is mitigated greatly by caching. So for a new user this is a big hit first time, then there should just be a much smaller delta as new topics are streamed. I cannot speak to how efficiently the local browser caches results of scaled images to optimise things though.

A modern fast computer on a modern internet link should have no issue with that, but a mobile computer, tablet or phone might have if they have not cached anything and are downloading the Topic List for the first time.

All that said, my iPad mini 4 on cellular copes completely fine with examples I’m aware of.

So I have not personally found it an issue at all and Tiles is not available as an option on phones presently anyway.

Only one user has told us recently that he would not use this feature as I believe they may have allowed Discourse to store very large images.

The proper solution is to update the codebase to scale image size whilst respecting the original aspect ratio. Presently the current thumbnail code, when set to do so, simply scales and crops to the chosen size, almost certainly losing the original aspect ratio of at least some of your images. This makes Tiles view more boring as it relies on variation in the aspect ratios for layout variety and in addition the cropping of course can make some of the images look awkward. Thus it remains the administrators trade-off.

This is “doable” and highly desirable, we just haven’t prioritised it.


Just to let everyone know, I’m aware of the issue with the Category column that’s now been removed from core Discourse. This now means that TLP shows Users where it should show Category in the table header for some views (Social and Tiles views are not impacted) I’ll take a look!

(T. H. Wright) #61

I did not! I didn’t even think about it. Something in my mind separated the two and attributed infinite scroll to the plugin. My mistake! I will do more reading.

(Angus McLeod) #62

Hey guys,

As @merefield mentioned, the removal of the category column from the standard topic list caused an issue with this plugin.

There was an existing setting in this plugin “topic list category badge move” which made the same move that has now been adopted in core. Since this is now a core feature, I’ve removed that setting from the plugin, rectifying the immediate issue.

You can see it live here: Topic List Previews - Angus' Sandbox

Separately, @merefield is working on a new feature which will restore the existing category column for those who prefer the old style. That will be merged soon.

Add Category Column

Hi all, I have a simple question
Is there a setting that I can hide the ‘like’ icon in the topic card? If no, I can modify it from theme setting.