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
.# Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby
require 'delivery-sdk-ruby'
delivery_client = Kontent::Ai::Delivery::DeliveryClient.new project_id: '975bf280-fd91-488c-994c-2f04416e5ee3',
preview_key: '<YOUR_PREVIEW_API_KEY>'
delivery_client.item('my_article').execute do |response|
item = response.item
end
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.