1

I'd like to show a lightning component on a public Force.com Site. I've created a lightning app and put my component into the app. Then I added it into my Visualforce page.

Lightning App:

<aura:application description="PrivacyPageApp" access="GLOBAL" implements="ltng:allowGuestAccess" extends="ltng:outApp">
    <aura:dependency resource="RGDPR:PrivacyPage" />
</aura:application>

Visualforce Page:

<apex:page standardStylesheets="false" showHeader="false" sideBar="false" cache="false">
    <apex:includeLightning />

    <div id="lightningComponent" />

    <script>
        $Lightning.use("RGDPR:PrivacyPageApp", function() {
            $Lightning.createComponent(
                "RGDPR:PrivacyPage",
                {
                    leadContactId: '{!$CurrentPage.parameters.id}',
                    pageId: '{!$CurrentPage.parameters.pageId}'
                },
                "lightningComponent",
                function(component) {

                }
            );
        });
    </script>
</apex:page>

I enabled Community. Must I create any community?

Empty Community

But when I go to my Visualforce page I get an error message in Chrome console:

enter image description here

How to make it work for Force.com sites?

1 Answer 1

4

You don't need to create a community for this.

You need to create one site (setup -> site -> New). In Active Site Home Page you need to select your VF page name. To create a site, first you need to have a domain name.

I was able to create it by just copy-pasting your code with the exception of using default namespace (c:)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .