Redirect / for non-logged in users?

Just copy and paste riking’s script here into </head> in Admin -> Customize -> CSS/HTML to have the logo redirect to /latest.

To make categories the landing page, go to Admin -> Site Settings -> Basic Setup and make categories the first entry in the list for the top menu setting.


Works a treat :smiley:

Thanks so much for quick reply.

My new forum setup is coming along nicely So much nicer than our old Durpal 6
PHP setup

1 Like

Uh - and @Yuun’s code broke again:

Error: Could not find module discourse/components/home-logo

Where did that disappear to? Did a quick recursive grep, but came up with nothing?!

It’s broke because the new header.

Yup, seen that, thanks. I guess I will x-post my question there since it belongs to that new addition.

I’ve added a new widget setting to customize that url in this commit:

Here’s an example of how to use it via a customization:

<script type="text/discourse-plugin" version="0.4">
  api.changeWidgetSetting('home-logo', 'href', '/new-url')

Just replace /new-url whatever you want the path to be and you should be good to go.


I want to change the behavior of the home logo only when users are at my home page (window.location === ‘’).

Should passing a function as the third parameter work?

Hmmm, how did you do that before? I thought targetUrl was just a parameter?

Thanks a lot Robin - looks great. Only that the snippet you posted just gives me this error:

TypeError: Attempted to assign to readonly property.

or, on Chrome:

Uncaught TypeError: Cannot set property 'href' of undefined

…and makes the whole header disappear.

I guess I’m just missing something here?

Did you get the latest master first? I tried it locally and it worked fine.

That’s the first thing I did before trying it! Is there a special section where I have to put the script code?

Aha it seems the tests-passed branch failed to build due to a failing test. I’m fixing it now.

edit: fixed the test. Give it 15-20 mins and it should have a new version for you.


Sorry, this was done in a hurry :laughing:

  window.goToPortal = function() { 
      if (window.location.href === '') { 
          window.location = '';

  var HeaderView = require('discourse/views/header').default

    didInsertElement : function(){
      this._super();'afterRender', this, this.afterRenderEvent);
    afterRenderEvent : function(){
      var logo = $('img#site-logo.logo-big').parent()[0];
      logo.addEventListener('click', window.goToPortal, false);

Can you help me @eviltrout ?

Like a charm. Thanks!

Hmmm that is a little complicated to establish in the new settings. Does adding that event work in the case where the url is not ? It seems the click handler would do nothing.

Yes, when the user isn’t at the forum home, I want the normal behavior (scroll up / go back to home).

Only when we are already at the forum home, I want to go back to my Portal home.

It’s quite tricky to do what you’re asking, because once an event is handled from the logo it prevents default.

I’ve added the ability for the href setting to be a function. Whatever value you return will be the destination when the user clicks the logo:


Should this work?

<script type="text/discourse-plugin" version="0.4">
  api.changeWidgetSetting('home-logo', 'href', function() { 
          return '';


Setting it to ‘/another/page’ when using Discourse under ‘/forum’ also breaks :sadpanda:.

1 Like

This should fix it:


I’ll test this later today! Thanks! :heart:

1 Like