Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
You can change the default landing page in CommunitiesLandingController. CommunitiesLandingPage is the Active Site Home Page for your community, meaning that it is shown when someone enters a direct URL to your community.
Here are the steps to update the CommunitiesLandingController code to redirect to the new page:
- Click Setup. - Enter Apex classes in quick find box and click it. - Find CommunitiesLandingController and click Edit. - The default code of CommunitiesLandingController below:
/** * An apex page controller that takes the user to the right start page based on credentials or lack thereof */ public with sharing class CommunitiesLandingController { // Code we will invoke on page load. public PageReference forwardToStartPage() { return Network.communitiesLanding(); } public CommunitiesLandingController() {} }
The new code will be:- /** * An apex page controller that takes the user to the right start page based on credentials or lack thereof */ public with sharing class CommunitiesLandingController {
// Code we will invoke on page load. public PageReference forwardToStartPage() { String communityUrl = 'https://google.com'; //URL of new page return new PageReference(communityUrl); }
public CommunitiesLandingController() {} }
- At last Click Save
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Greetings to you!
Please refer to the below links which might help you further with the above requirement.
https://help.salesforce.com/articleView?id=networks_configure_custom_home_page_with_oauth.htm&type=5
https://blog.webnersolutions.com/change-landing-page-of-community-website
https://salesforce.stackexchange.com/questions/186253/communities-cannot-change-home-page-to-my-custom-community-builder-page
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
You can change the default landing page in CommunitiesLandingController. CommunitiesLandingPage is the Active Site Home Page for your community, meaning that it is shown when someone enters a direct URL to your community.
Here are the steps to update the CommunitiesLandingController code to redirect to the new page:
- Click Setup.
- Enter Apex classes in quick find box and click it.
- Find CommunitiesLandingController and click Edit.
- The default code of CommunitiesLandingController below:
/**
* An apex page controller that takes the user to the right start page based on credentials or lack thereof
*/
public with sharing class CommunitiesLandingController {
// Code we will invoke on page load.
public PageReference forwardToStartPage() {
return Network.communitiesLanding();
}
public CommunitiesLandingController() {}
}
The new code will be:-
/**
* An apex page controller that takes the user to the right start page based on credentials or lack thereof
*/
public with sharing class CommunitiesLandingController {
// Code we will invoke on page load.
public PageReference forwardToStartPage() {
String communityUrl = 'https://google.com'; //URL of new page
return new PageReference(communityUrl);
}
public CommunitiesLandingController() {}
}
- At last Click Save
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi