How to add topic excerpt to all my topics

Hello community,

Hacking discourse a bit, I realise that only the pinned topics are the ones that brings the excerpt and while I can update the serialiser of the topic to bring that excerpt attr I would like to avoid to hack with backend as it gets more difficult to maintain that just hacking the client.

The question is:
What is different from the pinned topics from standard topics that only the pinned ones can display the excerpt?

As an image is better than a thousand words. This is my local environment within the latest page as you can see only the pinned topic brings the excerpt. Why? and How I can change that by using a Discourse theme?

It sounds wrong to assume is not possible as those excerpt get enabled when we pin a topic. I guess what I need is to Tweak the query that the discovery topics page does in order in to ask the excerpt always… but honestly, I still have hard times understanding how the data flow goes within discourse even after having some experience hacking this.

Documentation about how data flow of discourse works would be helpful too.

Thanks a lot!!


A theme can opt-in to excerpts now! This is a very recent change and I don’t think we have it documented in the guides yet.

Check here for an example:


Very good, @Falco

I was just about to answer Alexis but saw you guys typing.

To answer his general question a little, inclusion of data is often determined by the prevailing serializer.

When I went to check for this example, I found:

and specifically:

  def include_excerpt?
    pinned || SiteSetting.always_include_topic_excerpts || scope.request).serialize_topic_excerpts

Which kind of gives it away :slight_smile:


Deeply apologise to arrive so late to the conversation to say thank you! hahaha. But well, thanks a lot for jumping super quick I read it as soon you guys posted but I was in my phone unable to login into the platform. Thanks! :blush:


For anyone finding this topic on a search, you can now use: Topic List Excerpts Theme Component

1 Like