I have customized the route /home and created a new homepage. Now I want users to be redirected to my /home page when they click on /. Currently, it defaults to redirecting to /latest.
What is the best way to modify this?
I have customized the route /home and created a new homepage. Now I want users to be redirected to my /home page when they click on /. Currently, it defaults to redirecting to /latest.
What is the best way to modify this?
Are you using the custom_homepage approach? It’s our recommended method discussed here.
It works like this:
Step 1 — Enable the modifier in your theme’s about.json:
{
"name": "My Custom Homepage Theme",
"modifiers": {
"custom_homepage": true
}
}
Step 2 — Create a connector for the custom-homepage outlet or use Block System
javascripts/discourse/connectors/custom-homepage/my-homepage.gjs
import Component from "@glimmer/component";
export default class MyHomepage extends Component {
<template>
{{! Your custom homepage content goes here }}
<div class="my-custom-homepage">
<h1>Welcome!</h1>
</div>
</template>
}
Block system:
The /home method is outdated.
At the same time, you’d want to make sure you’ve set your own (and for users) ‘default home page’ to the (default) option in Preferences > Interface.
So on Meta, on the Meta Branded theme, because I selected ‘Latest’, I do not get the custom homepage that was created via the method in @chapoi 's post, instead getting the latest topic view.