# Modificare il modello TopicExcerpt?

**URL:** https://meta.discourse.org/t/modify-topicexcerpt-template/352136
**Category:** Development
**Created:** [13 Febbraio 2025, 7:12pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136 "2025-02-13T19:12:52Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![dsims](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dsims/32/485916_2.png) [@dsims](https://meta.discourse.org/u/dsims)
#### Post date: [13 Febbraio 2025, 7:12pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/1 "2025-02-13T19:12:53Z")

</div>

Voglio aggiungere l’avatar del creatore dell’argomento agli estratti dell’elenco degli argomenti, ma non sembra esserci alcun modo per modificare l’estratto dell’argomento.

TopicExcerpt:

> <https://github.com/discourse/discourse/blob/5f00ae2ca9cebb94667d0a6c40b472db10e04beb/app/assets/javascripts/discourse/app/components/topic-list/topic-excerpt.gjs>

Penso che l’unica opzione sia nascondere `.topic-excerpt` con CSS e utilizzare il mio componente tramite il `topic-list-main-link-bottom` Plugin Outlet che si trova appena sotto l’area TopicExcerpt. Il problema con _questo_ è che il plugin outlet riceve solo l’argomento come parametro, quindi devo duplicare tutta la logica in [`expandPinned`](https://github.com/discourse/discourse/blob/5f00ae2ca9cebb94667d0a6c40b472db10e04beb/app/assets/javascripts/discourse/app/components/topic-list/item.gjs#L57) per sapere se devo mostrarlo o meno.

tl;dr; **Potremmo avere un PluginOutlet all’interno di TopicExcerpt e/o passare `@expandPinned` agli outlet `topic-list-main-link-bottom`?**

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [13 Febbraio 2025, 7:20pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/2 "2025-02-13T19:20:12Z")

</div>

Ora hai più opzioni, vedi:

> [@Customizing the topic list](https://meta.discourse.org/t/customizing-the-topic-list/350411?u=merefield):
>
> The topic-list is one of the most-used and most-customized user-interfaces in Discourse. There are many different tools available to theme and plugin developers to achieve this customization, each with their own advantages, disadvantages and maintenance considerations. CSS-based Customization The safest and most common customization method is CSS. As with any other Discourse customization: the more complex your changes, the more maintenance is likely to be required in your theme or plugin. Gen…

---

<div class="post-metadata">

### Author: ![dsims](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dsims/32/485916_2.png) [@dsims](https://meta.discourse.org/u/dsims)
#### Post date: [13 Febbraio 2025, 7:31pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/3 "2025-02-13T19:31:48Z")

</div>

Per quanto ne so, ho esaminato tutte le opzioni. Non vedo alcun modo chirurgico per modificare solo l’estratto.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [13 Febbraio 2025, 7:32pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/4 "2025-02-13T19:32:38Z")

</div>

sì, c’è, eliminalo e aggiungi il tuo

---

<div class="post-metadata">

### Author: ![dsims](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dsims/32/485916_2.png) [@dsims](https://meta.discourse.org/u/dsims)
#### Post date: [13 Febbraio 2025, 7:40pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/5 "2025-02-13T19:40:51Z")

</div>

> [@merefield](#):
>
> eliminalo y añade el tuyo

Intendi sostituire l’intero elemento dell’elenco dell’argomento con il mio? Vorrei evitare di dover mantenere tutto questo quando voglio solo modificare una piccola parte.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [13 Febbraio 2025, 7:41pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/6 "2025-02-13T19:41:18Z")

</div>

no, sostituisci la cella degli estratti, oppure aggiungine un’altra accanto e nascondila.

---

<div class="post-metadata">

### Author: ![dsims](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dsims/32/485916_2.png) [@dsims](https://meta.discourse.org/u/dsims)
#### Post date: [13 Febbraio 2025, 7:46pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/7 "2025-02-13T19:46:54Z")

</div>

> [@merefield](#):
>
> sostituisci la cella dell’estratto

L’estratto non è una cella. Viene utilizzato all’interno di [topic-cell](https://github.com/discourse/discourse/blob/321a220b4905990874b4c36797cbe53056a5e02a/app/assets/javascripts/discourse/app/components/topic-list/item/topic-cell.gjs#L134) e in [mobile item](https://github.com/discourse/discourse/blob/321a220b4905990874b4c36797cbe53056a5e02a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs#L334)

> <https://github.com/discourse/discourse/blob/321a220b4905990874b4c36797cbe53056a5e02a/app/assets/javascripts/discourse/app/components/topic-list/item/topic-cell.gjs#L134>

Puoi anche vedere lì che il plugin-outlet `topic-list-main-link-bottom` nelle vicinanze passa solo @topic, ma non @expandPinned.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [13 Febbraio 2025, 7:52pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/8 "2025-02-13T19:52:42Z")

</div>

Ah sì, hai ragione, mi scuso.

Ho visto il file nei componenti della lista degli argomenti e ho fatto un’ipotesi.

Ma in ogni caso, ci sono molti strumenti per ottenere ciò che desideri qui, no?

L’outlet del plugin sembra una buona opzione e poi manipolare il layout con CSS?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [13 Febbraio 2025, 8:00pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/9 "2025-02-13T20:00:38Z")

</div>

Per quanto riguarda expandPinned, forse replicare la logica nel tuo nuovo Component quanto necessario?

> <https://github.com/discourse/discourse/blob/321a220b4905990874b4c36797cbe53056a5e02a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs#L57>

---

<div class="post-metadata">

### Author: ![dsims](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dsims/32/485916_2.png) [@dsims](https://meta.discourse.org/u/dsims)
#### Post date: [13 Febbraio 2025, 8:35pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/10 "2025-02-13T20:35:38Z")

</div>

> [@merefield](#):
>
> per l’espansione dei pinned, forse replicare la logica

Sì, è la strada che stavo percorrendo. Il che significa anche replicare

```plaintext
  get useMobileLayout() {
    return applyValueTransformer(
      "topic-list-item-mobile-layout",
      this.site.mobileView,
      { topic: this.args.outletArgs.topic }
    );
  }
  //e da discovery/topics.js
  get expandGloballyPinned() {
    !this.expandAllPinned();
  }
  get expandAllPinned() {
    const category = this.discovery.category?.id
    const tag = this.discovery.tag?.id
    return category || tag;
  }

```

Speravo che invocare gli dei potesse produrre un’opzione più pulita 🙏 😅

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [13 Febbraio 2025, 8:36pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/11 "2025-02-13T20:36:26Z")

</div>

> [@dsims](#):
>
> Speravo che invocare gli dei potesse produrre un’opzione più pulita 🙏 😅

È quello che faccio di solito il lunedì mattina.

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [14 Febbraio 2025, 2:39pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/12 "2025-02-14T14:39:47Z")

</div>

> [@dsims](#):
>
> pass `@expandPinned` all’outlet `topic-list-main-link-bottom`

questo sembra ragionevole, quindi l’ho fatto qui:

> <https://github.com/discourse/discourse/pull/31334>
>
> Requested on Meta, seems reasonable: https://meta.discourse.org/t/modify-topicex…cerpt-template/352136

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [16 Marzo 2025, 2:40pm UTC](https://meta.discourse.org/t/modify-topicexcerpt-template/352136/13 "2025-03-16T14:40:10Z")

</div>

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