Topic List Previews allows you to modify Discourse topic lists in various ways. This is an explanation of how it works and the various settings available.
The ‘Topic Post’
For the features that allow you to add (‘preview’) parts of a post from the topic to the topic list entry, the post being ‘previewed’ (the ‘Topic Post’) is either:
- the first post of the topic; or
- the accepted answer of the topic (see Discourse Solved).
If the topic has an accepted answer it will take precedence over the first post.
There are currently no settings that allow you to change the logic of what is used as the Topic Post.
I have grouped the settings below according to their functionality. All settings are applied to all topic lists individually. For non-category lists, the settings are in Admin > Settings > Plugins. They all start with the phrase
topic list. For category lists, see Category Settings > Settings.
Parts of the Topic Post that you can add to the topic list
These settings each add new elements to the Topic List. They take up the bulk of the plugin logic.
topic list thumbnails: Display a thumbnail of the first image used in the Topic Post. The thumbnails used are newly generated thumbnail images, optimized for the thumbnail size set in
topic list thumbnail widthand
topic list thumbnail height(see below). Each generated thumbnail has two sizes: normal and retina (x2). If the user’s display is a retina display the retina thumbnail will be used.
topic list excerpts: Display an excerpt of the text (see further
topic list excerpt lengthbelow) in the Topic Post
topic list actions: Include the Like and Bookmark actions, and the Like Count, of the Topic Post. These are real interactive buttons that operate in the same way the Like and Bookmark buttons on the actual post in the topic do.
Ways you can change the Topic Post parts
topic list default thumbnail: This setting allows you to set a default image that will be used if the Topic Post does not have an image in it. It requires a direct url for the image.
topic list excerpt length: This setting allows you to change the the number of characters from the Topic Post used in the
topic list excerpt. Note that, unless the
social media layoutsetting is enabled, the maximum height of each topic list item is 100px (this cannot be changed currently - 10/12/16). This means that if you make the excerpt too long, it will squeeze out the other elements of the topic list item. I would not recommend that you set the excerpt longer than 300 characters, unless it is the only part of the Topic Post that you are adding to the topic list item.
topic list thumbnail widthand
topic list thumbnail height(G): These settings effect both: 1) the size of the thumbnail image that is generated when the Topic Post is posted; and 2) the dimensions of the thumbnail element in the topic list item. This means that if you set them to new values, the existing thumbnail image files will still be the same dimensions as the old values. If a thumbnail is larger than the current dimensions, it will be constrained to the current dimensions (not noticeable to the user, however you will be loading a file larger than necessary). If a thumbnail is smaller than the current dimensions it will not be stretched to fit them, rather a thumbnail with the thumbnail dimensions will be displayed.
topic list show like on current users posts: This setting was requested by a user. Please review that use case before using it.
topic list hotlink thumbnails: This setting was requested by a user. Please review that use case before using it. I would not recommend using it unless absolutely necessary.
Ways you can change the layout of the topic list
topic list category badge move: Display the Category Badge of the topic underneath the topic title in the topic list item, rather than in a separate column.
topic list social media discovery: This setting changes the entire layout of the topic list to resemble ‘social media’ platforms like Medium and Quora. By itself, it does not add new elements to the topic list. However, if any of the Topic Post parts are added by the settings mentioned above, e.g. thumbnails or excerpts, they will be handled according to the ‘social media’ style. There is a more detailed description of the setting itself here and an explanation of the thinking behind it here.
topic list social media only latest: This setting was built by @pmusaraj. It restricts the social media layout to the ‘latest’ filter. This setting will be expanded to include settings for other filters and categories.
topic list mobile previews: This setting applies all Topic List Previews logic to mobile web. All of the settings work mutatis mutandis on mobile web.
The current development needs are:
Bugfixes. As the setting list continues to grow there will be more edge cases to deal with.
Performance. This is important and I would appreciate help with it. See my longer description here.