Other way was by Installing Custom top navigation links. It allowed me to add control nav links but route path “/” (root) is yet coming the “Latest”
Other was was by manipulating “discourse/app/routes/app-route-map.js” where is defined the “filters”. But didn’t workout too.
this.route("discovery", { path: "/", resetNamespace: true }, function () {
My goal:
Change the Topic List that comes from “http://localhost:3000/” from “Latest” to “Following”, it’s possible thankful to Follow Plugin 👨. Because this route already exists, so If I get “/following” it works, but I wanted this route to perform over “/” path.
Here I added Bookmarks to the possible default view:
The hardest part was adding the test cases!
I would consider this as a PR to the plugin. The tricky part is that it currently only appears if there is something to show … so you’d need to consider that …
Didn’t workout, I thought with these changes would be possible to choose “Top menu” site settings. So If “latest” is required I would put “following” - “latest” in sequence, this way home would be redirected to “following”.
I found a way during development from
import { setDefaultHomepage } from 'discourse/lib/utilities';
So, in my component, in the beginning I have put
setDefaultHomepage("following");
Because in Rails Console, I have found a variable SiteSetting.homepage which was “latest”.
And worked !
Do you see any problems ?
I’m afraid of loading latest from backend and initializer to be loaded in client-side.
No you won’t be able to change the Ruby file directly. It was just a clue. After all you will not be submitting a PR to core like I was doing in that case. You will have to find some way of amending that from the plugin initialiser in plugin.rb I suspect … this will be a change to the plugin not core.
Haha, well that’s one way of doing it, but really you should append it as an option, and always give the user the option to change it … at least if you want this to be merged into the plugin