Add category to top menu so that category can be landing page

Continuing the discussion from Invalid items can be added to the top_menu setting:

Is there an example of how to do this somewhere (that I can’t find)? I think that I want to do something like

<script type="text/discourse-plugin" version="0.8.25">
  api.modifyClass('component:edit-category-settings', {
    availableSorts: Ember.computed(function() {
    let sorts = this._super();
    let voteSort = {};
    voteSort["name"] = "Votes";
    voteSort["value"] = "votes";
    return sorts;

except I want to target the top menu component. I’m not sure where to look for it, though.

Edit: And now that I’ve grepped the source for edit-category-settings I’m even more confused. :thinking:

Well, Custom top navigation links will let you add other things to the nav menu, but it won’t let you change the default landing page.

Is there a way to change the default landing page?

The homepage is set here:

I believe @tshenry has a theme component that allows you to override the hompage on mobile, but it has fixed options like latest / top / unread.

You can can still re-purpose the code in that component. You can use something like this in the common header section

<script type="text/discourse-plugin" version="0.8">
    const { setDefaultHomepage } = require('discourse/lib/utilities');
    setDefaultHomepage('/c/category-slug'); // <--- set homepage url

This will override any homepage preferences the user sets, but it should be possible to check those preferences and only force the homepage if the user hasn’t changed that preference.