function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mahamed raheemmahamed raheem 

Navigate to another LWC component in sites page

Navigate to another LWC component in the sites page
I have tried below but it's not working

import { LightningElement,track,wire} from 'lwc';
import { NavigationMixin } from 'lightning/navigation'; 
export default class Request_GeneralInfo_lwc  extends NavigationMixin(LightningElement) {



// button click 
ContinueReview(event){
this[NavigationMixin.Navigate]({
            type: 'comm__namedPage',
            attributes: {
                pageName: 'c__request_Review_LWC'
            },
            state: {
                'category': 'param1value'
               }
        });
}

In this scenario, I have to navigate request_Review_LWC lwc component in the sites page
Danish HodaDanish Hoda
Hi Raheem,
You cannot directly navigate to an LWC, you need to create an aura:component and embed your LWC in that component.
Please refer the link for better understanding : https://developer.salesforce.com/forums/ForumsMain?id=9062I000000Xva5QAC
mahamed raheemmahamed raheem
Hi Danish,

I created aura component and embedded my LWC in that but it's not navigating to another LWC
My LWC components are used in ltng:outApp

 below code am using 

My Aura APP:
<aura:application extends="ltng:outApp" access="GLOBAL" implements="ltng:allowGuestAccess">
<aura:dependency resource="request_GeneralInfo_lwc"/>

vf Page: 

apex:page sidebar="false" showheader="false">
     <apex:includeLightning />
    <div id="lightningvf" />

    <script>
        $Lightning.use("c:request_App", function() {
          $Lightning.createComponent("c:request_GeneralInfo_lwc",{
          
          },
             "lightningvf",
              function(cmp) {
                console.log("CMP was created");
                
              }
          );
        });
    </script>
</apex:page>

LWC
import { LightningElement,track,wire} from 'lwc';
import { NavigationMixin } from 'lightning/navigation'; 
export default class Request_GeneralInfo_lwc  extends NavigationMixin(LightningElement) {


// button click 
ContinueReview(){
this[NavigationMixin.Navigate]({ "type": "standard__component",
"attributes": {
"componentName": "c__auraComponent" } });
}

Aura cmp:

<aura:component implements="lightning:isUrlAddressable" access="global" >
<lightning:card title="LWC Navigation">

</lightning:card>
</aura:component>
Danish HodaDanish Hoda

Hi Raheem,
Might be that ltng:outApp isrestricting your navigation.

You would need to debug it propely, firstly try to check if ContinueReview() method was called and navigated to your Aura cmp as expected, then dive further to check the other LWC.

Ankit Solanki 6Ankit Solanki 6
This is link help you better : https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.use_navigate_page_types
Ankit Solanki 6Ankit Solanki 6
HI @mahamed raheem, it's solved or still open query ?
mahamed raheemmahamed raheem
Hello Ankit its not solved still open