Orchard Core Facebook/Meta Integration - Prompt Templates
Module Overview
The OrchardCore.Facebook module provides Facebook/Meta integrations for Orchard Core applications. It includes the following features:
- OrchardCore.Facebook — Core components: registers the Meta App with the site and loads the Facebook SDK.
- OrchardCore.Facebook.Login — Enables user authentication via Meta/Facebook accounts.
- OrchardCore.Facebook.Widgets — Adds Meta Social Plugin widgets (Like, Share, Comments, etc.).
- OrchardCore.Facebook.Pixel — Adds Meta Pixel tracking to the site.
Meta Core Components
Guidelines
- Enable the
OrchardCore.Facebookfeature as a prerequisite for all other Meta features. - Obtain an
AppIdandAppSecretfrom the Meta for Developers page under Basic Settings. - Configure settings via Settings → Integrations → Meta App in the admin dashboard.
- The SDK is registered with ResourceManager as resources
fbandfbsdk, usable from Liquid or Razor templates. - Set "Init on every page" to load the SDK globally, or leave disabled for on-demand loading.
Meta App Settings
| Setting | Description |
|---|---|
| AppId | Meta application ID from the developer portal. |
| AppSecret | The application secret from the developer portal. |
| Javascript SDK Version | The Facebook SDK version to load (e.g., v3.2). |
| Javascript Sdk js | The SDK JS file to load (e.g., sdk.js). |
| Init on every page | If enabled, the SDK loads on every page; otherwise on demand. |
| Parameters for FB.init() | Comma-separated key-values passed to FB.init() (e.g., status:true,xfbml:true,autoLogAppEvents:true). |
Meta Login Authentication
Guidelines
- Enable the
OrchardCore.Facebook.Loginfeature (requiresOrchardCore.Facebookcore feature). - Enable the Meta Login Product in the Meta for Developers page for web apps.
- Set a valid OAuth redirect URI in the Meta developer portal.
- The default callback URL is
[tenant]/signin-facebook. - If the site allows registration, a local user is created and linked on first Meta login.
- If a local user with the same email exists, the external login is linked to that account.
- Enable
OrchardCore.Users.Registrationto allow new user sign-ups through Meta login. - Existing users can link their Meta account via the External Logins link in the User menu.
Meta Login Settings
| Setting | Description |
|---|---|
| CallbackPath | Request path for the OAuth callback. Defaults to /signin-facebook. |
Meta Social Plugins Widgets
Guidelines
- Enable the
OrchardCore.Facebook.Widgetsfeature (requiresOrchardCore.Facebookcore feature). - This feature adds a
FacebookPlugincontent part that integrates Meta Social Plugins. - The SDK must be loaded on the page (either via "Init on every page" or on-demand).
Available Widget Types
| Widget | Description |
|---|---|
| Chat | Embeds a Messenger chat plugin on the page. |
| Comments | Adds a comments section powered by Facebook. |
| Continue With | Displays a "Continue with Facebook" button. |
| Like | Adds a Like button for the page or URL. |
| Quote | Enables quote sharing from the page. |
| Save | Adds a Save button for bookmarking content. |
| Share | Adds a Share button to share content on Facebook. |
Meta Pixel Tracking
Guidelines
- Enable the
OrchardCore.Facebook.Pixelfeature. - Navigate to Settings → Integrations → Meta Pixel in the admin dashboard.
- Enter your Pixel Identifier obtained from the Meta Events Manager.
- The pixel tracking code is automatically injected on all front-end pages once configured.
Meta Pixel Settings
| Setting | Description |
|---|---|
| Pixel Identifier | The Meta Pixel ID for tracking (e.g., 1234567890). |
Meta Settings Configuration Override
Override admin settings via appsettings.json by calling ConfigureFacebookSettings() on OrchardCoreBuilder:
{
"OrchardCore_Facebook": {
"AppId": "",
"AppSecret": "",
"FBInit": false,
"FBInitParams": "status:true,xfbml:true,autoLogAppEvents:true",
"SdkJs": "sdk.js",
"Version": "v3.2"
}
}
Using the Facebook SDK in Templates
Razor
<script-resource name="fbsdk"></script-resource>
Liquid
{% scriptresource name: "fbsdk" %}
User Registration
- Enable
OrchardCore.Users.Registrationfor new user sign-ups through Meta login. - Existing users can link accounts via the External Logins link in the user menu.
- When a local user with the same email exists, the external login is automatically linked after authentication.