Can I change the URL of the main logo?

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 Likes

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 Likes

sorry for the necro, but how do i make this open into a new tab instead of self? is the target blank usable here?

This takes a little more customization because it’s prevented in the home-logo widget here:

So you’d have to use changeWidgetSetting to set the URL, and then reopenWidget to add _blank and override the default click behavior that prevents it from opening in a new window.

<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 Likes

thank you for the excellent explanation. i sort of found a work around to what i was after by adding an icon link to the header with url to what i wanted the logo to go to and into another tab. it works and gave the users what they wanted in the end (the link to the external home site on the header). personally i prefer it the way it is because i like using the logo as my forum home link.

2 Likes