How can I increase the category description character amount or remove the truncation on the home page?
AI-generated summary
Category Description Truncating
The discussion revolves around removing the truncation of category descriptions on the homepage. Ziirahdane asks how to increase the character limit or remove the truncation. Johani explains that category descriptions are based on the first paragraph of the “About” topic, and Ziirahdane provides a screenshot of the issue.
Johani reveals that the truncation happens on the server and is limited to 300 characters, but offers a solution using a theme component to bypass this limit. The provided code snippet allows for the full description to be displayed. Ziirahdane confirms that this solution meets their needs.
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.
The description excerpt truncation happens on the server here.
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>
Thank you, that is perfect for my needs!
