Category description truncating

How can I increase the category description character amount or remove the truncation on the home page?

The category description is based on the first paragraph in the “About” topic for that category. So, if you want to make the descriptions longer, add the information to the first paragraph.

Yes, I have a longer description inputted in the About topic, but I am specifically referencing how to remove the truncating as shown here:

1 Like

The description excerpt truncation happens on the server here.

https://github.com/discourse/discourse/blob/06084fb8be70a35968675da670c778cd34c1f551/app/models/category.rb#L316-L323

It’s limited to 300 characters, and there’s no setting for that. However, you can use a theme component to bypass that and override the property and make it use the full description (the entire first paragraph).

Try adding something like this in the header section of a theme component.

<script type="text/discourse-plugin" version="0.8">
  const { on } = require("ember-addons/ember-computed-decorators");

  api.modifyClass("component:parent-category-row", {
    @on("init")
    updateDescription() {
      this.set(
        "attrs.category.description_excerpt",
        this.attrs.category.description
      );
    }
  });
</script>
1 Like

Thank you, that is perfect for my needs!

2 Likes