Sarà più facile creare un componente personalizzato che aggiunga questo ai post corretti anziché riempire un modello.
Se modifichi il codice del tuo tema sotto admin themes components… e aggiungi questo alla scheda JS, dovresti ottenere ciò che desideri con qualche aggiustamento:
import { apiInitializer } from "discourse/lib/api";
import Component from "@glimmer/component";
class TopicIdentifier extends Component {
get topicId() {
return this.args.post?.topic?.id;
}
get shouldShow() {
const firstPost = this.args.post?.post_number === 1; // primo post nell'argomento
const desiredCategories = [45, 3]; // un elenco separato da virgole di ID di categoria in cui desideri che questo appaia
const isInCategory = desiredCategories.includes(
this.args.post.topic.category.id
);
return firstPost
&& isInCategory;
}