Preview configuration
Is this page helpful?
example.org
URL, for example.preview.example.org
URL, for example.https://domain/path
{Space}
: space domain{URLslug}
: content item’s URL slug element value{Lang}
: codename of the selected language{Codename}
: content item’s codename{ItemId}
: content item’s internal ID{Collection}
: content item’s collection codename
{URLslug}
macro: https://preview.example.org/articles/{URLslug}
. Alternatively, you can use the {Codename}
or {ItemId}
macros to identify the content items in your preview URLs.
In multi-regional projects, use the {Lang}
macro to get the currently selected language codename, such as en-us
or ja-jp
.
You can combine the macros. A preview URL https://preview.example.org/{Lang}/articles/{URLslug}
would resolve to https://preview.example.org/en-ca/articles/previewing-content-items
, for example.
https://preview.example.org
would be https://preview.example.org
or https://{Space}
.
<iframe>
within Kontent.ai, you need to ensure a few things:https://preview.example.org
.Content-Security-Policy
header and the frame-ancestors directive: frame-ancestors https://app.kontent.ai
.sandbox
directives using the Content-Security-Policy
header. For example, the directive allow-popups-to-escape-sandbox
allows opening external links, allow-forms
allows submitting forms, allow-downloads
allows downloads after users click a link, and so on.SameSite=None; Secure
.<?php
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
// Defined by Composer to include required libraries
require __DIR__ . '/vendor/autoload.php';
use Kontent\Ai\Delivery\DeliveryClient;
$client = new DeliveryClient('<YOUR_ENVIRONMENT_ID>', '<YOUR_PREVIEW_API_KEY>');
$item = $client->getItem('my_article');
?>
https://
protocol and URLs accessible to Kontent.ai. Without a valid SSL certificate, Kontent.ai responds with secure connection errors.
When developing apps locally, you can serve pages over HTTPS in combination with ngrok's forwarded address.