Posso cambiare l'URL del logo principale?

For example, let’s say I wanted the logo to point to forum.example.com/latest instead of forum.example.com, how would I do that? Is that something I can change easily without needing a developer? Discourse is hosting my forum, if that makes any difference.

The reason I want that is because I want my default forum page when someone goes on the forum to be the “Categories” page so the forum is less intimidating. But I want them to go on the “Latest” page once they click on the logo.

This should work in a theme:

<script type="text/discourse-plugin" version="0.4">
    api.changeWidgetSetting('home-logo', 'href', '/latest')
</script>
3 Mi Piace

Thanks! Since I’m a noob, could you specify where to paste this? I assume it’s not where the CSS goes?

Goes into the HEAD section to the right of the CSS one. You can learn about it on Developer’s guide to Discourse Themes

4 Mi Piace

mi dispiace per il necro, ma come faccio a farlo aprire in una nuova scheda invece che in sé stesso? il target blank è utilizzabile qui?

Ciò richiede un po’ più di personalizzazione perché è impedito nel widget home-logo qui:

Quindi dovresti usare changeWidgetSetting per impostare l’URL, e poi reopenWidget per aggiungere _blank e sovrascrivere il comportamento di click predefinito che impedisce l’apertura in una nuova finestra.

<script type="text/discourse-plugin" version="0.8">
  const { h } = require("virtual-dom");

  api.changeWidgetSetting('home-logo', 'href', 'https://discourse.org');

  api.reopenWidget("home-logo", {
     html() {
       return h(
         "a",
         { attributes: { href: this.href(), "data-auto-route": true, "target": "_blank" } },
         this.logo()
       );
     },

     click(e) {
       return;
     },
   });
</script>
4 Mi Piace

grazie per l’ottima spiegazione. Ho trovato una soluzione alternativa a quello che cercavo aggiungendo un link icona all’intestazione con l’URL a cui volevo che andasse il logo e in un’altra scheda. Funziona e alla fine ha dato agli utenti quello che volevano (il link al sito home esterno nell’intestazione). Personalmente preferisco così perché mi piace usare il logo come link alla home del forum.

2 Mi Piace