Lightning SFDC, SFDC Customization

Lightning Component On Public Website (ltng:allowguestaccess)

In latest release salesforce came up with a powerful interface ie ltng:allowguestaccess which allows you to expose your lightning component or Lightning web component on public websites ie force.com sites or any community with public page which doesn’t require user authentication.

Lets take an example of a simple lightning component which we will expose to community as public page.
I have created a basic lightning component named forceeditrecord to show list of contact with edit button.
Next step is to enclose this component in a lightning app which extends ltng:outapp and implements ltng:allowguestaccess as below.

Now we need to create a visualforce page which will show this lightning app. Later we will use this visualforce page to show in community.

The process of exposing the lightning component in vf page is discussed in my previous blog.

If you notice there are only two changes we did to expose it on public site ie

This will use to access library directly from community.

Also we have added community URL in the page as endpoint url.

Leave a Reply