A new "default homepage" site setting

Currently to change the homepage of your Discourse site, you have to configure the site setting top menu and put your desired homepage as the first option in the list. This is a behavior that’s fairly unclear to new admins.

Today we’re merging a change that adds a new default homepage site setting to make this a clearer and easier process.

Existing sites won’t need to do anything, as the default for this new setting is first item in top menu which is the same functionality we’ve always had. The same options are present in the new setting as well. If you choose a homepage that is only available to logged-in users, like new, we’ll still fall back to the first top menu item available to anonymous visitors.

One change this new setting unlocks is that you can now have a homepage that isn’t present in the top menu. So for example, you can set categories as your homepage and remove that from the top menu setting, as the link to all categories is also available in the sidebar.

In the future we may add some new options for homepages, so keep an eye out for more updates!

20 Likes

This is a very nice addition Kris! :clap:

Since we’re about to introduce a new homepage via the custom-homepage outlet, I’m curious if this new setting will include the custom homepage when a plugin or a theme-component introduces one. As I was planning to update user preferences to reset the homepage setting to default -1.

So, following up on that will this new setting update the options in user preferences’ homepage setting as well?

Lastly, if default homepage is set to first item in top menu, and there is a custom link added via api.addNavigationBarItem() and placed as the first item, will it actually be treated as the first item?

4 Likes

No, this is still the same. The theme modifier for custom homepages overrides the site setting entirely. Navigating this is a little complicated because if a site has multiple themes available, and one doesn’t have a custom homepage, we’d have to manage fallback. Something for us to consider.

Not yet… the options are still the same as top menu anyway, but one thing that did change is that default will always be available in user preferences now (previously it was conditional). “Default” in user preferences will follow the site setting.

Also a “not yet” here too — outside of a custom homepage in a theme, the homepage of a Discourse site still has various requirements about being a topic list page (or /categories) and api.addNavigationBarItem() has much looser requirements.

3 Likes

Thanks Kris. I’m very much invested in this, and curious how it’ll progress.

One observation I can share is that when a theme-component introduces a custom homepage, the users with personalized homepage settings will never get to see it.

Unlike the top menu items, the custom homepage doesn’t have a path that I can create a custom menu item for it.

This is the very reason, even though it feels like an extreme decision, I was planning on resetting user preferences to use the default -1 value. AFAICT, this will be my only option to give all users to see the new homepage. After that they can still personalize it on their preferences.

2 Likes

I think the path is /custom.

2 Likes

TIL. Thanks @Moin that works indeed.

Though, /custom wouldn’t be my first choice for a homepage path :))

You can use permalinks to use something like /home

yes, thanks, but that “redirects” the request, and still lands on /custom

1 Like