How can I keep post views on lists

We have a poetry forum. In a single post, it looks normal like a poem, but the excerpt display view becomes a paragraph or combined text style on the homepage or category listings. The original post views are lost. I tried different things, different themes or the “topic list previews” plugin didn’t work. How can I show excerpts like poetry (e.g. first three lines or max lines with excerpt length) on homepage or specific category page.
Thanks for support.

You might check the value of SiteSetting traditional markdown linebreaks. The description reads: “Use traditional linebreaks in Markdown, which require two trailing spaces for a linebreak.”

That is a bit confusing, but I think that you have this checked and you want it unchecked. Or maybe I’m confused.

1 Like

Thanks Jay, I tried but it didn’t work. I don’t know how but in the excerpt it combines all the sentences into one paragraph

Hi Proje DEV! :slight_smile:

Are you using Topic List Excerpts?

I believe you need a plugin if you want to override it to keep line breaks.

I think his is what would need to be overridden: discourse/topics_controller.rb at main · discourse/discourse · GitHub

More specifically, this line:

I didn’t try, but this may be useful for this purpose: Override existing Discourse methods in plugins

I’d be happy to have a look, but I don’t have a development install right now (and I’m bad at coding, so hopefully someone more skilled will have a more suitable answer). :slight_smile:

1 Like

Hello, I think you can try it with white-space: pre-line it will keeps the topic line breaks in excerpt. :slightly_smiling_face:

Add this to Common > CSS

.topic-list {
  a.topic-excerpt {
    white-space: pre-line;

Screenshot 2023-02-05 at 1.43.46


Thanks Don. It works :+1:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.